[PATCH] D43876: [LoopUnroll] Peel off iterations if it makes conditions true/false.
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 28 11:58:16 PST 2018
efriedma added inline comments.
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:154
+ unsigned DesiredPeelCount = 0;
+ PHINode *IndVar = L->getCanonicalInductionVariable();
+ if (!IndVar)
Please don't use getCanonicalInductionVariable; indvars doesn't generate canonical induction variables anymore, so this will only handle limited cases.
Can you use SCEV here instead?
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:177
+ if (Bound <= MaxPeelCount)
+ DesiredPeelCount = std::max(DesiredPeelCount, Bound);
This doesn't check for the possibility that the induction variable could wrap... not a correctness problem, of course, but it's not clear the transform is profitable in that case.
More information about the llvm-commits