summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-02-24 15:34:43 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-02-24 15:34:43 +0000
commitee40b9a2d4f5d340baea3f02e5d7f51caaa6b1ec (patch)
tree06146827a61b9a081126d29fb70f2ac9ba5c5f8c /llvm/test
parentb867fea5e631ba022fcd8047ba845e5a56a2ff98 (diff)
downloadbcm5719-llvm-ee40b9a2d4f5d340baea3f02e5d7f51caaa6b1ec.tar.gz
bcm5719-llvm-ee40b9a2d4f5d340baea3f02e5d7f51caaa6b1ec.zip
CVP: If we have a PHI with an incoming select, try to skip the select.
This is a common pattern with dyn_cast and similar constructs, when the PHI no longer depends on the select it can often be turned into a simpler construct or even get hoisted out of the loop. PR15340. llvm-svn: 175995
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/CorrelatedValuePropagation/basic.ll20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
index 06b60f15d42..39c437ccfae 100644
--- a/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
+++ b/llvm/test/Transforms/CorrelatedValuePropagation/basic.ll
@@ -81,6 +81,26 @@ LessThanOrEqualToTwo:
ret i32 0
}
+declare i32* @f(i32*)
+define void @test5(i32* %x, i32* %y) {
+; CHECK: @test5
+entry:
+ %pre = icmp eq i32* %x, null
+ br i1 %pre, label %return, label %loop
+
+loop:
+ %phi = phi i32* [ %sel, %loop ], [ %x, %entry ]
+; CHECK: %phi = phi i32* [ %f, %loop ], [ %x, %entry ]
+ %f = tail call i32* @f(i32* %phi)
+ %cmp1 = icmp ne i32* %f, %y
+ %sel = select i1 %cmp1, i32* %f, i32* null
+ %cmp2 = icmp eq i32* %sel, null
+ br i1 %cmp2, label %return, label %loop
+
+return:
+ ret void
+}
+
define i32 @switch1(i32 %s) {
; CHECK: @switch1
entry:
OpenPOWER on IntegriCloud