[PATCH] D11706: [Unroll] Improve the brute force loop unroll estimate by propagating through PHI nodes across iterations.
Michael Zolotukhin
mzolotukhin at apple.com
Sun Aug 2 23:32:43 PDT 2015
mzolotukhin added a comment.
Hi Chandler,
That's really cool! Looks good to me.
Michael
================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:551-553
@@ +550,5 @@
+ // this analysis.
+ assert(L->isLoopSimplifyForm() && "Must put loop into normal form first.");
+ assert(L->isLCSSAForm(DT) &&
+ "Must have loops in LCSSA form to track live-out values.");
+
----------------
Shouldn't we just bail out in this case instead of crashing with assert?
IOW, is it possible to make a loop, that won't be simplified, but will reach this point?
================
Comment at: test/Transforms/LoopUnroll/full-unroll-heuristics-phi-prop.ll:14-22
@@ +13,11 @@
+ %x0 = phi i64 [ 0, %entry ], [ %x9, %loop ]
+ %x1 = or i64 %x0, 1
+ %x2 = or i64 %x1, 2
+ %x3 = or i64 %x2, 3
+ %x4 = or i64 %x3, 4
+ %x5 = or i64 %x4, 5
+ %x6 = or i64 %x5, 6
+ %x7 = or i64 %x6, 7
+ %x8 = or i64 %x7, 8
+ %x9 = or i64 %x8, 9
+ %inc = add nuw nsw i64 %iv, 1
----------------
Maybe just leave first 2-3 of them to make the test shorter?
```
%x1 = or i64 %x0, 1
%x2 = or i64 %x1, 2
```
http://reviews.llvm.org/D11706
More information about the llvm-commits
mailing list