Index: tests_lit/llvm2ice_tests/branch-simple.ll |
diff --git a/tests_lit/llvm2ice_tests/branch-simple.ll b/tests_lit/llvm2ice_tests/branch-simple.ll |
index 6702790c298bd0948a5ac2b29521b873e504df6b..c054a14ae76154f586d9d58627bcce1e17583890 100644 |
--- a/tests_lit/llvm2ice_tests/branch-simple.ll |
+++ b/tests_lit/llvm2ice_tests/branch-simple.ll |
@@ -1,7 +1,11 @@ |
-; Trivial smoke test of compare and branch, with multiple basic |
+; 1. Trivial smoke test of compare and branch, with multiple basic |
; blocks. |
+; 2. For a conditional branch on a constant boolean value, make sure |
+; we don't lower to a cmp instructions with an immediate as the first |
+; source operand. |
-; RUN: %llvm2ice %s --verbose inst | FileCheck %s |
+; RUN: %llvm2ice -O2 --verbose inst %s | FileCheck %s |
+; RUN: %llvm2ice -Om1 --verbose inst %s | FileCheck %s |
; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
@@ -15,6 +19,7 @@ Equal: |
ret i32 %foo |
Unequal: |
ret i32 %bar |
+; CHECK-LABEL: simple_cond_branch |
; CHECK: br i1 %r1, label %Equal, label %Unequal |
; CHECK: Equal: |
; CHECK: ret i32 %foo |
@@ -22,5 +27,16 @@ Unequal: |
; CHECK: ret i32 %bar |
} |
+define internal i32 @test_br_const() { |
+__0: |
+ br i1 1, label %__1, label %__2 |
+__1: |
+ ret i32 21 |
+__2: |
+ ret i32 43 |
+} |
+; CHECK-LABEL: test_br_const |
+; CHECK-NOT: cmp {{[0-9]*}}, |
+ |
; ERRORS-NOT: ICE translation error |
; DUMP-NOT: SZ |