r193995 - CodeGen: Test that simple expressions are simplified at -O0
Justin Bogner
mail at justinbogner.com
Mon Nov 4 08:13:23 PST 2013
Author: bogner
Date: Mon Nov 4 10:13:23 2013
New Revision: 193995
URL: http://llvm.org/viewvc/llvm-project?rev=193995&view=rev
Log:
CodeGen: Test that simple expressions are simplified at -O0
Added:
cfe/trunk/test/CodeGen/branch-on-bool.c
Added: cfe/trunk/test/CodeGen/branch-on-bool.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/branch-on-bool.c?rev=193995&view=auto
==============================================================================
--- cfe/trunk/test/CodeGen/branch-on-bool.c (added)
+++ cfe/trunk/test/CodeGen/branch-on-bool.c Mon Nov 4 10:13:23 2013
@@ -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();
+}
More information about the cfe-commits
mailing list