[PATCH] D30632: [LoopUnrolling] Fix loop size check for peeling
Michael Kuperstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 5 23:45:16 PST 2017
mkuper accepted this revision.
mkuper added a comment.
This revision is now accepted and ready to land.
LGTM with a style nit.
================
Comment at: lib/Transforms/Utils/LoopUnrollPeel.cpp:78
// invariant instead of this Phi.
- if (auto *BackEdge = L->getLoopLatch()) {
- BasicBlock *Header = L->getHeader();
- // Iterate over Phis to find one with invariant input on back edge.
- bool FoundCandidate = false;
- PHINode *Phi;
- for (auto BI = Header->begin(); isa<PHINode>(&*BI); ++BI) {
- Phi = cast<PHINode>(&*BI);
- Value *Input = Phi->getIncomingValueForBlock(BackEdge);
- if (L->isLoopInvariant(Input)) {
- FoundCandidate = true;
- break;
+ if (LoopSize <= UP.Threshold) {
+ if (auto *BackEdge = L->getLoopLatch()) {
----------------
I would combine this into a single if with a &&, rather than two nested ones.
https://reviews.llvm.org/D30632
More information about the llvm-commits
mailing list