summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2013-07-24 12:12:17 +0000
committerChandler Carruth <chandlerc@gmail.com>2013-07-24 12:12:17 +0000
commit58e25d390542978c93ce425410eec0278a401624 (patch)
tree338a1dc68cd38efcdb02421fe3c7051e9eb2f914 /llvm/test
parent8cfb43f73b23715c6acc14b13178c3f9a4b9edab (diff)
downloadbcm5719-llvm-58e25d390542978c93ce425410eec0278a401624.tar.gz
bcm5719-llvm-58e25d390542978c93ce425410eec0278a401624.zip
Fix a problem I introduced in r187029 where we would over-eagerly
schedule an alloca for another iteration in SROA. This only showed up with a mixture of promotable and unpromotable selects and phis. Added a test case for this. llvm-svn: 187031
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/SROA/phi-and-select.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/Transforms/SROA/phi-and-select.ll b/llvm/test/Transforms/SROA/phi-and-select.ll
index 9f2b191778d..8d82964dcbd 100644
--- a/llvm/test/Transforms/SROA/phi-and-select.ll
+++ b/llvm/test/Transforms/SROA/phi-and-select.ll
@@ -346,6 +346,43 @@ exit:
ret i32 %load
}
+define i32 @test14(i1 %b1, i1 %b2, i32* %ptr) {
+; Check for problems when there are both selects and phis and one is
+; speculatable toward promotion but the other is not. That should block all of
+; the speculation.
+; CHECK-LABEL: @test14(
+; CHECK: alloca
+; CHECK: alloca
+; CHECK: select
+; CHECK: phi
+; CHECK: phi
+; CHECK: select
+; CHECK: ret i32
+
+entry:
+ %f = alloca i32
+ %g = alloca i32
+ store i32 0, i32* %f
+ store i32 0, i32* %g
+ %f.select = select i1 %b1, i32* %f, i32* %ptr
+ br i1 %b2, label %then, label %else
+
+then:
+ br label %exit
+
+else:
+ br label %exit
+
+exit:
+ %f.phi = phi i32* [ %f, %then ], [ %f.select, %else ]
+ %g.phi = phi i32* [ %g, %then ], [ %ptr, %else ]
+ %f.loaded = load i32* %f.phi
+ %g.select = select i1 %b1, i32* %g, i32* %g.phi
+ %g.loaded = load i32* %g.select
+ %result = add i32 %f.loaded, %g.loaded
+ ret i32 %result
+}
+
define i32 @PR13905() {
; Check a pattern where we have a chain of dead phi nodes to ensure they are
; deleted and promotion can proceed.
OpenPOWER on IntegriCloud