[PATCH] D30243: [LoopUnrolling] Re-prioritize Peeling and Partial unrolling
Michael Kuperstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 21 22:42:15 PST 2017
mkuper added inline comments.
================
Comment at: lib/Transforms/Scalar/LoopUnrollPass.cpp:789
+ computePeelCount(L, LoopSize, UP);
+ if (UP.PeelCount) {
+ UP.Runtime = false;
----------------
The current heuristic is supposed to be that we only peel when we don't know the trip count, but have an approximate one due to profile information. Partial unrolling requires a known trip count. So in the old code, they don't actually compete for priority, and this change looks like it should be NFC.
I'm not sure this is completely NFC, though - I don't remember if computePeelCount actually enforces an unknown trip count, or just assumes it's unknown, because otherwise we'd quit at line 838. So you probably want this to be "if (!TripCount && UP.PeelCount)", or change computePeelCount() to bail on a known trip count. Otherwise, what you may in effect be doing is enabling peeling for loops with a constant low trip count that we chose not to unroll. Which is probably not something you want to do.
https://reviews.llvm.org/D30243
More information about the llvm-commits
mailing list