summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2019-04-17 04:52:47 +0000
committerEric Christopher <echristo@gmail.com>2019-04-17 04:52:47 +0000
commitcee313d288a4faf0355d76fb6e0e927e211d08a5 (patch)
treed386075318d761197779a96e5d8fc0dc7b06342b /llvm/test/Transforms/IPConstantProp/dangling-block-address.ll
parentc3d6a929fdd92fd06d4304675ade8d7210ee711a (diff)
downloadbcm5719-llvm-cee313d288a4faf0355d76fb6e0e927e211d08a5.tar.gz
bcm5719-llvm-cee313d288a4faf0355d76fb6e0e927e211d08a5.zip
Revert "Temporarily Revert "Add basic loop fusion pass.""
The reversion apparently deleted the test/Transforms directory. Will be re-reverting again. llvm-svn: 358552
Diffstat (limited to 'llvm/test/Transforms/IPConstantProp/dangling-block-address.ll')
-rw-r--r--llvm/test/Transforms/IPConstantProp/dangling-block-address.ll42
1 files changed, 42 insertions, 0 deletions
diff --git a/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll b/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll
new file mode 100644
index 00000000000..abd0b0fc313
--- /dev/null
+++ b/llvm/test/Transforms/IPConstantProp/dangling-block-address.ll
@@ -0,0 +1,42 @@
+; RUN: opt < %s -internalize -ipsccp -S | FileCheck %s
+; PR5569
+
+; IPSCCP should prove that the blocks are dead and delete them, and
+; properly handle the dangling blockaddress constants.
+
+; CHECK: @bar.l = internal constant [2 x i8*] [i8* inttoptr (i32 1 to i8*), i8* inttoptr (i32 1 to i8*)]
+
+@code = global [5 x i32] [i32 0, i32 0, i32 0, i32 0, i32 1], align 4 ; <[5 x i32]*> [#uses=0]
+@bar.l = internal constant [2 x i8*] [i8* blockaddress(@bar, %lab0), i8* blockaddress(@bar, %end)] ; <[2 x i8*]*> [#uses=1]
+
+define void @foo(i32 %x) nounwind readnone {
+entry:
+ %b = alloca i32, align 4 ; <i32*> [#uses=1]
+ store volatile i32 -1, i32* %b
+ ret void
+}
+
+define void @bar(i32* nocapture %pc) nounwind readonly {
+entry:
+ br label %indirectgoto
+
+lab0: ; preds = %indirectgoto
+ %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
+ br label %indirectgoto
+
+end: ; preds = %indirectgoto
+ ret void
+
+indirectgoto: ; preds = %lab0, %entry
+ %indvar = phi i32 [ %indvar.next, %lab0 ], [ 0, %entry ] ; <i32> [#uses=2]
+ %pc.addr.0 = getelementptr i32, i32* %pc, i32 %indvar ; <i32*> [#uses=1]
+ %tmp1.pn = load i32, i32* %pc.addr.0 ; <i32> [#uses=1]
+ %indirect.goto.dest.in = getelementptr inbounds [2 x i8*], [2 x i8*]* @bar.l, i32 0, i32 %tmp1.pn ; <i8**> [#uses=1]
+ %indirect.goto.dest = load i8*, i8** %indirect.goto.dest.in ; <i8*> [#uses=1]
+ indirectbr i8* %indirect.goto.dest, [label %lab0, label %end]
+}
+
+define i32 @main() nounwind readnone {
+entry:
+ ret i32 0
+}
OpenPOWER on IntegriCloud