[PATCH] D25963: [LoopUnroll] Implement profile-based loop peeling
Adam Nemet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 28 12:14:20 PST 2016
anemet accepted this revision.
anemet added a comment.
LGTM with some minor changes.
================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:137
+ uint64_t FallThruWeight =
+ PeeledHeaderWeight * ((float)(AvgIters - IterNumber) / AvgIters * 0.9);
+ uint64_t ExitWeight = PeeledHeaderWeight - FallThruWeight;
----------------
Why the 0.9? This also needs a comment.
================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:204-219
+ // Change the incoming values to the ones defined in the preheader or
+ // the previous cloned loop body.
+ for (BasicBlock::iterator I = Header->begin(); isa<PHINode>(I); ++I) {
+ PHINode *NewPHI = cast<PHINode>(VMap[&*I]);
+ if (IterNumber == 0) {
+ VMap[&*I] = NewPHI->getIncomingValueForBlock(PreHeader);
+ } else {
----------------
This needs a bit more comment; here we're turning values that were before defined by the loop PHIs to use values directly from the preheader or the previous cloned loop body.
https://reviews.llvm.org/D25963
More information about the llvm-commits
mailing list