summaryrefslogtreecommitdiff
path: root/test/CodeGen/branch-on-bool.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-12-22 00:07:40 +0000
commitbfef399519ca9b8a4b4c6b563253bad7e0eeffe0 (patch)
treedf8df0b0067b381eab470a3b8f28d14a552a6340 /test/CodeGen/branch-on-bool.c
parent6a0372513edbc473b538d2f724efac50405d6fef (diff)
Diffstat (limited to 'test/CodeGen/branch-on-bool.c')
-rw-r--r--test/CodeGen/branch-on-bool.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/branch-on-bool.c b/test/CodeGen/branch-on-bool.c
new file mode 100644
index 000000000000..78dae1b1fd78
--- /dev/null
+++ b/test/CodeGen/branch-on-bool.c
@@ -0,0 +1,22 @@
+// RUN: %clang %s -O0 -emit-llvm -S -o - | FileCheck %s
+
+void foo();
+void bar();
+
+void fold_if(int a, int b) {
+ // CHECK: define {{.*}} @fold_if(
+ // CHECK-NOT: = phi
+ // CHECK: }
+ if (a && b)
+ foo();
+ else
+ bar();
+}
+
+void fold_for(int a, int b) {
+ // CHECK: define {{.*}} @fold_for(
+ // CHECK-NOT: = phi
+ // CHECK: }
+ for (int i = 0; a && i < b; ++i) foo();
+ for (int i = 0; a || i < b; ++i) bar();
+}