summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SimplifyCFG
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-06-04 14:11:59 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-06-04 14:11:59 +0000
commita5e536ab0e785dc6fcff76420b65fa592d29b7e0 (patch)
tree5d10e4ae01c87a6ee5ebc9a69bb2ea6d8d848d69 /llvm/test/Transforms/SimplifyCFG
parent863746eb1a681dabdd99816b73372b0fe2d114b8 (diff)
downloadbcm5719-llvm-a5e536ab0e785dc6fcff76420b65fa592d29b7e0.tar.gz
bcm5719-llvm-a5e536ab0e785dc6fcff76420b65fa592d29b7e0.zip
Second part of pr16069
The problem this time seems to be a thinko. We were assuming that in the CFG A | \ | B | / C speculating the basic block B would cause only the phi value for the B->C edge to be speculated. That is not true, the phi's are semantically in the edges, so if the A->B->C path is taken, any code needed for A->C is not executed and we have to consider it too when deciding to speculate B. llvm-svn: 183226
Diffstat (limited to 'llvm/test/Transforms/SimplifyCFG')
-rw-r--r--llvm/test/Transforms/SimplifyCFG/PR16069.ll16
1 files changed, 15 insertions, 1 deletions
diff --git a/llvm/test/Transforms/SimplifyCFG/PR16069.ll b/llvm/test/Transforms/SimplifyCFG/PR16069.ll
index 4e9f89660c4..0b3d6779451 100644
--- a/llvm/test/Transforms/SimplifyCFG/PR16069.ll
+++ b/llvm/test/Transforms/SimplifyCFG/PR16069.ll
@@ -1,8 +1,9 @@
; RUN: opt < %s -simplifycfg -S | FileCheck %s
-; CHECK-NOT: select
@b = extern_weak global i32
+
define i32 @foo(i1 %y) {
+; CHECK: define i32 @foo(i1 %y) {
br i1 %y, label %bb1, label %bb2
bb1:
br label %bb3
@@ -10,5 +11,18 @@ bb2:
br label %bb3
bb3:
%cond.i = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ]
+; CHECK: phi i32 {{.*}} srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2
ret i32 %cond.i
}
+
+define i32 @foo2(i1 %x) {
+; CHECK: define i32 @foo2(i1 %x) {
+bb0:
+ br i1 %x, label %bb1, label %bb2
+bb1:
+ br label %bb2
+bb2:
+ %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
+; CHECK: %cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
+ ret i32 %cond
+}
OpenPOWER on IntegriCloud