[PATCH] D44983: [LoopUnroll] Only peel if a predicate becomes known in the loop body.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 02:09:10 PDT 2018


fhahn added inline comments.


================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:218
+
+    // Only peel the loop if if !Pred becomes known in the first iteration of
+    // the loop body after peeling.
----------------
junbuml wrote:
> if Pred or !Pred 
In terms of the original Pred, `Pred or !Pred` is precise, but at this stage Pred is set so that it is known in the peeled part (it is set to the inverse predicate earlier, if the original Pred is not known). Therefore I think it is slightly clearer to refer to just !Pred here. What do you think?


================
Comment at: test/Transforms/LoopUnroll/peel-loop-conditions.ll:341
 
-; Test that we respect MaxPeelCount
+; Test that we only peel off iterations if it simplifies a condition in the
+; loop body.
----------------
junbuml wrote:
> I think you should add another test to show the case where MaxPeelCount is respected.
I think this test case still checks that MaxPeelCount is respected. Without checking MaxPeelCount, we would peel off 9999 iterations. I have updated the comment and tried to highlight that fact.


https://reviews.llvm.org/D44983





More information about the llvm-commits mailing list