summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>2014-12-02 14:22:34 +0000
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>2014-12-02 14:22:34 +0000
commitd035fbb96f58df15964fa6f0cef0110656de678f (patch)
treef4296ff4129d6d4d007a260fd859314618bdfcb2 /llvm/test
parent7f43266778cffe586899c326a778de2497a6e22c (diff)
downloadbcm5719-llvm-d035fbb96f58df15964fa6f0cef0110656de678f.tar.gz
bcm5719-llvm-d035fbb96f58df15964fa6f0cef0110656de678f.zip
[LICM] Avoind store sinking if no preheader is available
Load instructions are inserted into loop preheaders when sinking stores and later removed if not used by the SSA updater. Avoid sinking if the loop has no preheader and avoid crashes. This fixes one more side effect of not handling indirectbr instructions properly on LoopSimplify. llvm-svn: 223119
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/LICM/sinking.ll33
1 files changed, 33 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LICM/sinking.ll b/llvm/test/Transforms/LICM/sinking.ll
index f01367b01aa..d7a8fcdafca 100644
--- a/llvm/test/Transforms/LICM/sinking.ll
+++ b/llvm/test/Transforms/LICM/sinking.ll
@@ -359,6 +359,39 @@ lab22:
indirectbr i8* undef, [label %lab5, label %lab6, label %lab7]
}
+; Test that we don't crash when trying to sink stores and there's no preheader
+; available (which is used for creating loads that may be used by the SSA
+; updater)
+define void @test13() {
+; CHECK-LABEL: @test13
+ br label %lab59
+
+lab19:
+ br i1 undef, label %lab20, label %lab38
+
+lab20:
+ br label %lab60
+
+lab21:
+ br i1 undef, label %lab22, label %lab38
+
+lab22:
+ br label %lab38
+
+lab38:
+ ret void
+
+lab59:
+ indirectbr i8* undef, [label %lab60, label %lab38]
+
+lab60:
+; CHECK: lab60:
+; CHECK: store
+; CHECK-NEXT: indirectbr
+ store i32 2145244101, i32* undef, align 4
+ indirectbr i8* undef, [label %lab21, label %lab19]
+}
+
declare void @f(i32*)
declare void @g()
OpenPOWER on IntegriCloud