[llvm] r249173 - [Tests] Give meaningful names to blocks in LoopUnroll/pr18861.ll, add a description of what's going on.
Michael Zolotukhin via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 12:21:49 PDT 2015
Author: mzolotukhin
Date: Fri Oct 2 14:21:49 2015
New Revision: 249173
URL: http://llvm.org/viewvc/llvm-project?rev=249173&view=rev
Log:
[Tests] Give meaningful names to blocks in LoopUnroll/pr18861.ll, add a description of what's going on.
Modified:
llvm/trunk/test/Transforms/LoopUnroll/pr18861.ll
Modified: llvm/trunk/test/Transforms/LoopUnroll/pr18861.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/LoopUnroll/pr18861.ll?rev=249173&r1=249172&r2=249173&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/LoopUnroll/pr18861.ll (original)
+++ llvm/trunk/test/Transforms/LoopUnroll/pr18861.ll Fri Oct 2 14:21:49 2015
@@ -2,30 +2,54 @@
@b = external global i32, align 4
+; Test that LoopUnroll does not break LCSSA form.
+;
+; In this function we have a following CFG:
+; ( entry )
+; |
+; v
+; ( outer.header ) <--
+; | \
+; v |
+; --> ( inner.header ) |
+; / / \ |
+; \ / \ |
+; \ v v /
+; ( inner.latch ) ( outer.latch )
+; |
+; v
+; ( exit )
+;
+; When the inner loop is unrolled, we inner.latch block has only one
+; predecessor and one successor, so it can be merged with exit block.
+; During the merge, however, we remove an LCSSA definition for
+; %storemerge1.lcssa, breaking LCSSA form for the outer loop.
+
; Function Attrs: nounwind uwtable
define void @fn1() #0 {
entry:
- br label %for.cond1thread-pre-split
+ br label %outer.header
-for.cond1thread-pre-split: ; preds = %for.inc5, %entry
- %storemerge1 = phi i32 [ 0, %entry ], [ %inc9, %for.inc5 ]
- br label %for.cond2
+outer.header: ; preds = %outer.latch, %entry
+ %storemerge1 = phi i32 [ 0, %entry ], [ %inc9, %outer.latch ]
+ br label %inner.header
-for.cond2: ; preds = %for.body3, %for.cond1thread-pre-split
- %storemerge = phi i32 [ %add, %for.body3 ], [ 0, %for.cond1thread-pre-split ]
+inner.header: ; preds = %inner.latch, %outer.header
+ %storemerge = phi i32 [ %add, %inner.latch ], [ 0, %outer.header ]
%cmp = icmp slt i32 %storemerge, 1
- br i1 %cmp, label %for.body3, label %for.inc5
+ br i1 %cmp, label %inner.latch, label %outer.latch
-for.body3: ; preds = %for.cond2
+inner.latch: ; preds = %inner.header
%tobool4 = icmp eq i32 %storemerge, 0
%add = add nsw i32 %storemerge, 1
- br i1 %tobool4, label %for.cond2, label %if.then
+ br i1 %tobool4, label %inner.header, label %exit
-if.then: ; preds = %for.body3
- store i32 %storemerge1, i32* @b, align 4
+exit: ; preds = %inner.latch
+ %storemerge1.lcssa = phi i32 [ %storemerge1, %inner.latch ]
+ store i32 %storemerge1.lcssa, i32* @b, align 4
ret void
-for.inc5: ; preds = %for.cond2
+outer.latch: ; preds = %inner.header
%inc9 = add nsw i32 %storemerge1, 1
- br label %for.cond1thread-pre-split
+ br label %outer.header
}
More information about the llvm-commits
mailing list