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

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 05:04:43 PDT 2018


mkazantsev added a comment.

I see the point, but predicate being true or false on `K+1`th iteration also does not guarantee that we can simplify the loop. I can agree that it is better than what we have now, I just wonder if this solution is general enough to deal with problem you are dealing with.



================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:200
+    // or !Pred in the loop body statically.
+    unsigned NewPeelCount = DesiredPeelCount;
+
----------------
fhahn wrote:
> mkazantsev wrote:
> > BTW, I just realized that this entire optimization will be harmful if the predicate is provable for `LeftAR, RightSCEV`. In this case, something is true on EVERY iteration, and you peel out SOME iterations thinking that it would be profitable.
> > 
> > Isn't it the real problem you are trying to win here?
> Are you referring where either Pred or !Pred is known for `LeftAr, RightSCEV` independently of the iteration? This case should be guarded against in line 176
Right, I haven't noticed this. Thanks for pointing out!


https://reviews.llvm.org/D44983





More information about the llvm-commits mailing list