summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/branch-on-bool.c
diff options
context:
space:
mode:
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 0000000..78dae1b
--- /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();
+}
OpenPOWER on IntegriCloud