summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/LoopStrengthReduce
diff options
context:
space:
mode:
authorAndrew Trick <atrick@apple.com>2011-10-04 03:50:44 +0000
committerAndrew Trick <atrick@apple.com>2011-10-04 03:50:44 +0000
commit8de329a9fc6100f4a8db6b86c76fad624446995e (patch)
tree95a5b140cb204f40065fc903a1e67018e7332f91 /llvm/test/Transforms/LoopStrengthReduce
parent411842f98f392c2974db6d8921dd1d6c48d95b5f (diff)
downloadbcm5719-llvm-8de329a9fc6100f4a8db6b86c76fad624446995e.tar.gz
bcm5719-llvm-8de329a9fc6100f4a8db6b86c76fad624446995e.zip
LSR should avoid redundant edge splitting.
This handles the case in which LSR rewrites an IV user that is a phi and splits critical edges originating from a switch. Fixes <rdar://problem/6453893> LSR is not splitting edges "nicely" llvm-svn: 141059
Diffstat (limited to 'llvm/test/Transforms/LoopStrengthReduce')
-rw-r--r--llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll43
1 files changed, 43 insertions, 0 deletions
diff --git a/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll b/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll
new file mode 100644
index 00000000000..a6996a81fb0
--- /dev/null
+++ b/llvm/test/Transforms/LoopStrengthReduce/2011-10-03-CritEdgeMerge.ll
@@ -0,0 +1,43 @@
+; RUN: opt -loop-reduce -S < %s | FileCheck %s
+;
+; Test LSR's use of SplitCriticalEdge during phi rewriting.
+; Verify that identical edges are merged. rdar://problem/6453893
+
+target triple = "x86-apple-darwin"
+
+; CHECK: @test
+; CHECK: bb89:
+; CHECK: phi i8* [ %lsr.iv.next1, %bbA.bb89_crit_edge ], [ %lsr.iv.next1, %bbB.bb89_crit_edge ]{{$}}
+
+define i8* @test() {
+entry:
+ br label %loop
+
+loop:
+ %rec = phi i32 [ %next, %loop ], [ 0, %entry ]
+ %next = add i32 %rec, 1
+ %tmp75 = getelementptr i8* null, i32 %next
+ br i1 false, label %loop, label %loopexit
+
+loopexit:
+ br i1 false, label %bbA, label %bbB
+
+bbA:
+ switch i32 0, label %bb89 [
+ i32 47, label %bb89
+ i32 58, label %bb89
+ ]
+
+bbB:
+ switch i8 0, label %bb89 [
+ i8 47, label %bb89
+ i8 58, label %bb89
+ ]
+
+bb89:
+ %tmp75phi = phi i8* [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbA ], [ %tmp75, %bbB ], [ %tmp75, %bbB ], [ %tmp75, %bbB ]
+ br label %exit
+
+exit:
+ ret i8* %tmp75phi
+}
OpenPOWER on IntegriCloud