summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopSimplify
diff options
context:
space:
mode:
authorMichael Zolotukhin <mzolotukhin@apple.com>2016-08-05 21:52:58 +0000
committerMichael Zolotukhin <mzolotukhin@apple.com>2016-08-05 21:52:58 +0000
commit4c65c3596a6339ef075c9edea2827562ef0cba9d (patch)
tree8702558d6c67052383fc5b485e07c016cc7a217e /llvm/test/Transforms/LoopSimplify
parent5e35eaac83f1fe150273c45a001024a8cf9b4064 (diff)
downloadbcm5719-llvm-4c65c3596a6339ef075c9edea2827562ef0cba9d.tar.gz
bcm5719-llvm-4c65c3596a6339ef075c9edea2827562ef0cba9d.zip
[LoopSimplify] Fix updating LCSSA after separating nested loops.
This fixes PR28825. The problem was that we only checked if a value from a created inner loop is used in the outer loop, and fixed LCSSA for them. But we missed to fixup LCSSA for values used in exits of the outer loop. llvm-svn: 277877
Diffstat (limited to 'llvm/test/Transforms/LoopSimplify')
-rw-r--r--llvm/test/Transforms/LoopSimplify/pr28272.ll34
1 files changed, 33 insertions, 1 deletions
diff --git a/llvm/test/Transforms/LoopSimplify/pr28272.ll b/llvm/test/Transforms/LoopSimplify/pr28272.ll
index 49990f92cab..e59d7636dca 100644
--- a/llvm/test/Transforms/LoopSimplify/pr28272.ll
+++ b/llvm/test/Transforms/LoopSimplify/pr28272.ll
@@ -1,7 +1,7 @@
; RUN: opt < %s -lcssa -loop-unroll -S | FileCheck %s
target triple = "x86_64-unknown-linux-gnu"
-; PR28272
+; PR28272, PR28825
; When LoopSimplify separates nested loops, it might break LCSSA form: values
; from the original loop might be used in the outer loop. This test invokes
; loop-unroll, which calls loop-simplify before itself. If LCSSA is broken
@@ -74,3 +74,35 @@ loop2.if.false:
bb:
br label %loop2
}
+
+; When LoopSimplify separates nested loops, it might break LCSSA form: values
+; from the original loop might be used in exit blocks of the outer loop.
+; CHECK-LABEL: @foo3
+define void @foo3() {
+entry:
+ br label %bb1
+
+bb1:
+ br i1 undef, label %bb2, label %bb1
+
+bb2:
+ %a = phi i32 [ undef, %bb1 ], [ %a, %bb3 ], [ undef, %bb5 ]
+ br i1 undef, label %bb3, label %bb1
+
+bb3:
+ %b = load i32*, i32** undef
+ br i1 undef, label %bb2, label %bb4
+
+bb4:
+ br i1 undef, label %bb5, label %bb6
+
+bb5:
+ br i1 undef, label %bb2, label %bb4
+
+bb6:
+ br i1 undef, label %bb_end, label %bb1
+
+bb_end:
+ %x = getelementptr i32, i32* %b
+ br label %bb_end
+}
OpenPOWER on IntegriCloud