forked from OSchip/llvm-project
[IndVarSimplify] Cleanup spaces and reduce variable scope [NFCI]
Minor clean-ups + clang-format.
This commit is contained in:
parent
6baf31b7c1
commit
b5b6126d97
|
@ -1676,7 +1676,7 @@ bool IndVarSimplify::simplifyAndExtend(Loop *L,
|
||||||
|
|
||||||
/// Given an Value which is hoped to be part of an add recurance in the given
|
/// Given an Value which is hoped to be part of an add recurance in the given
|
||||||
/// loop, return the associated Phi node if so. Otherwise, return null. Note
|
/// loop, return the associated Phi node if so. Otherwise, return null. Note
|
||||||
/// that this is less general than SCEVs AddRec checking.
|
/// that this is less general than SCEVs AddRec checking.
|
||||||
static PHINode *getLoopPhiForCounter(Value *IncV, Loop *L) {
|
static PHINode *getLoopPhiForCounter(Value *IncV, Loop *L) {
|
||||||
Instruction *IncI = dyn_cast<Instruction>(IncV);
|
Instruction *IncI = dyn_cast<Instruction>(IncV);
|
||||||
if (!IncI)
|
if (!IncI)
|
||||||
|
@ -1738,7 +1738,7 @@ static bool needsLFTR(Loop *L, BasicBlock *ExitingBB) {
|
||||||
BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
|
BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
|
||||||
if (L->isLoopInvariant(BI->getCondition()))
|
if (L->isLoopInvariant(BI->getCondition()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Do LFTR to simplify the exit condition to an ICMP.
|
// Do LFTR to simplify the exit condition to an ICMP.
|
||||||
ICmpInst *Cond = dyn_cast<ICmpInst>(BI->getCondition());
|
ICmpInst *Cond = dyn_cast<ICmpInst>(BI->getCondition());
|
||||||
if (!Cond)
|
if (!Cond)
|
||||||
|
@ -1781,9 +1781,9 @@ static bool needsLFTR(Loop *L, BasicBlock *ExitingBB) {
|
||||||
/// actually poison. This can be used to assess whether a new use of Root can
|
/// actually poison. This can be used to assess whether a new use of Root can
|
||||||
/// be added at a location which is control equivalent with OnPathTo (such as
|
/// be added at a location which is control equivalent with OnPathTo (such as
|
||||||
/// immediately before it) without introducing UB which didn't previously
|
/// immediately before it) without introducing UB which didn't previously
|
||||||
/// exist. Note that a false result conveys no information.
|
/// exist. Note that a false result conveys no information.
|
||||||
static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root,
|
static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root,
|
||||||
Instruction *OnPathTo,
|
Instruction *OnPathTo,
|
||||||
DominatorTree *DT) {
|
DominatorTree *DT) {
|
||||||
// Basic approach is to assume Root is poison, propagate poison forward
|
// Basic approach is to assume Root is poison, propagate poison forward
|
||||||
// through all users we can easily track, and then check whether any of those
|
// through all users we can easily track, and then check whether any of those
|
||||||
|
@ -1801,7 +1801,7 @@ static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root,
|
||||||
// If we know this must trigger UB on a path leading our target.
|
// If we know this must trigger UB on a path leading our target.
|
||||||
if (mustTriggerUB(I, KnownPoison) && DT->dominates(I, OnPathTo))
|
if (mustTriggerUB(I, KnownPoison) && DT->dominates(I, OnPathTo))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// If we can't analyze propagation through this instruction, just skip it
|
// If we can't analyze propagation through this instruction, just skip it
|
||||||
// and transitive users. Safe as false is a conservative result.
|
// and transitive users. Safe as false is a conservative result.
|
||||||
if (!propagatesFullPoison(I) && I != Root)
|
if (!propagatesFullPoison(I) && I != Root)
|
||||||
|
@ -1813,7 +1813,7 @@ static bool mustExecuteUBIfPoisonOnPathTo(Instruction *Root,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Might be non-UB, or might have a path we couldn't prove must execute on
|
// Might be non-UB, or might have a path we couldn't prove must execute on
|
||||||
// way to exiting bb.
|
// way to exiting bb.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1880,7 +1880,7 @@ static bool isLoopCounter(PHINode* Phi, Loop *L,
|
||||||
ScalarEvolution *SE) {
|
ScalarEvolution *SE) {
|
||||||
assert(Phi->getParent() == L->getHeader());
|
assert(Phi->getParent() == L->getHeader());
|
||||||
assert(L->getLoopLatch());
|
assert(L->getLoopLatch());
|
||||||
|
|
||||||
if (!SE->isSCEVable(Phi->getType()))
|
if (!SE->isSCEVable(Phi->getType()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -1941,7 +1941,7 @@ static PHINode *FindLoopCounter(Loop *L, BasicBlock *ExitingBB,
|
||||||
if (!hasConcreteDef(Phi)) {
|
if (!hasConcreteDef(Phi)) {
|
||||||
// We explicitly allow unknown phis as long as they are already used by
|
// We explicitly allow unknown phis as long as they are already used by
|
||||||
// the loop exit test. This is legal since performing LFTR could not
|
// the loop exit test. This is legal since performing LFTR could not
|
||||||
// increase the number of undef users.
|
// increase the number of undef users.
|
||||||
Value *IncPhi = Phi->getIncomingValueForBlock(LatchBlock);
|
Value *IncPhi = Phi->getIncomingValueForBlock(LatchBlock);
|
||||||
if (!isLoopExitTestBasedOn(Phi, ExitingBB) &&
|
if (!isLoopExitTestBasedOn(Phi, ExitingBB) &&
|
||||||
!isLoopExitTestBasedOn(IncPhi, ExitingBB))
|
!isLoopExitTestBasedOn(IncPhi, ExitingBB))
|
||||||
|
@ -1959,7 +1959,7 @@ static PHINode *FindLoopCounter(Loop *L, BasicBlock *ExitingBB,
|
||||||
if (!Phi->getType()->isIntegerTy() &&
|
if (!Phi->getType()->isIntegerTy() &&
|
||||||
!mustExecuteUBIfPoisonOnPathTo(Phi, ExitingBB->getTerminator(), DT))
|
!mustExecuteUBIfPoisonOnPathTo(Phi, ExitingBB->getTerminator(), DT))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const SCEV *Init = AR->getStart();
|
const SCEV *Init = AR->getStart();
|
||||||
|
|
||||||
if (BestPhi && !AlmostDeadIV(BestPhi, LatchBlock, Cond)) {
|
if (BestPhi && !AlmostDeadIV(BestPhi, LatchBlock, Cond)) {
|
||||||
|
@ -2165,14 +2165,14 @@ linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB,
|
||||||
// reasoning as from SimplifyIndvar::eliminateTrunc to see if we can extend
|
// reasoning as from SimplifyIndvar::eliminateTrunc to see if we can extend
|
||||||
// the other side of the comparison instead. We still evaluate the limit
|
// the other side of the comparison instead. We still evaluate the limit
|
||||||
// in the narrower bitwidth, we just prefer a zext/sext outside the loop to
|
// in the narrower bitwidth, we just prefer a zext/sext outside the loop to
|
||||||
// a truncate within in.
|
// a truncate within in.
|
||||||
bool Extended = false;
|
bool Extended = false;
|
||||||
const SCEV *IV = SE->getSCEV(CmpIndVar);
|
const SCEV *IV = SE->getSCEV(CmpIndVar);
|
||||||
const SCEV *TruncatedIV = SE->getTruncateExpr(SE->getSCEV(CmpIndVar),
|
const SCEV *TruncatedIV = SE->getTruncateExpr(SE->getSCEV(CmpIndVar),
|
||||||
ExitCnt->getType());
|
ExitCnt->getType());
|
||||||
const SCEV *ZExtTrunc =
|
const SCEV *ZExtTrunc =
|
||||||
SE->getZeroExtendExpr(TruncatedIV, CmpIndVar->getType());
|
SE->getZeroExtendExpr(TruncatedIV, CmpIndVar->getType());
|
||||||
|
|
||||||
if (ZExtTrunc == IV) {
|
if (ZExtTrunc == IV) {
|
||||||
Extended = true;
|
Extended = true;
|
||||||
ExitCnt = Builder.CreateZExt(ExitCnt, IndVar->getType(),
|
ExitCnt = Builder.CreateZExt(ExitCnt, IndVar->getType(),
|
||||||
|
@ -2190,7 +2190,7 @@ linearFunctionTestReplace(Loop *L, BasicBlock *ExitingBB,
|
||||||
if (Extended) {
|
if (Extended) {
|
||||||
bool Discard;
|
bool Discard;
|
||||||
L->makeLoopInvariant(ExitCnt, Discard);
|
L->makeLoopInvariant(ExitCnt, Discard);
|
||||||
} else
|
} else
|
||||||
CmpIndVar = Builder.CreateTrunc(CmpIndVar, ExitCnt->getType(),
|
CmpIndVar = Builder.CreateTrunc(CmpIndVar, ExitCnt->getType(),
|
||||||
"lftr.wideiv");
|
"lftr.wideiv");
|
||||||
}
|
}
|
||||||
|
@ -2344,11 +2344,10 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
L->getExitingBlocks(ExitingBlocks);
|
L->getExitingBlocks(ExitingBlocks);
|
||||||
|
|
||||||
// Remove all exits which aren't both rewriteable and analyzeable.
|
// Remove all exits which aren't both rewriteable and analyzeable.
|
||||||
auto NewEnd = llvm::remove_if(ExitingBlocks,
|
auto NewEnd = llvm::remove_if(ExitingBlocks, [&](BasicBlock *ExitingBB) {
|
||||||
[&](BasicBlock *ExitingBB) {
|
|
||||||
// If our exitting block exits multiple loops, we can only rewrite the
|
// If our exitting block exits multiple loops, we can only rewrite the
|
||||||
// innermost one. Otherwise, we're changing how many times the innermost
|
// innermost one. Otherwise, we're changing how many times the innermost
|
||||||
// loop runs before it exits.
|
// loop runs before it exits.
|
||||||
if (LI->getLoopFor(ExitingBB) != L)
|
if (LI->getLoopFor(ExitingBB) != L)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -2360,18 +2359,18 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
// If already constant, nothing to do.
|
// If already constant, nothing to do.
|
||||||
if (isa<Constant>(BI->getCondition()))
|
if (isa<Constant>(BI->getCondition()))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
|
const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
|
||||||
if (isa<SCEVCouldNotCompute>(ExitCount))
|
if (isa<SCEVCouldNotCompute>(ExitCount))
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
ExitingBlocks.erase(NewEnd, ExitingBlocks.end());
|
ExitingBlocks.erase(NewEnd, ExitingBlocks.end());
|
||||||
|
|
||||||
if (ExitingBlocks.empty())
|
if (ExitingBlocks.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Get a symbolic upper bound on the loop backedge taken count.
|
// Get a symbolic upper bound on the loop backedge taken count.
|
||||||
const SCEV *MaxExitCount = getMaxBackedgeTakenCount(*SE, *DT, L);
|
const SCEV *MaxExitCount = getMaxBackedgeTakenCount(*SE, *DT, L);
|
||||||
if (isa<SCEVCouldNotCompute>(MaxExitCount))
|
if (isa<SCEVCouldNotCompute>(MaxExitCount))
|
||||||
return false;
|
return false;
|
||||||
|
@ -2379,7 +2378,7 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
// Visit our exit blocks in order of dominance. We know from the fact that
|
// Visit our exit blocks in order of dominance. We know from the fact that
|
||||||
// all exits (left) are analyzeable that the must be a total dominance order
|
// all exits (left) are analyzeable that the must be a total dominance order
|
||||||
// between them as each must dominate the latch. The visit order only
|
// between them as each must dominate the latch. The visit order only
|
||||||
// matters for the provably equal case.
|
// matters for the provably equal case.
|
||||||
llvm::sort(ExitingBlocks,
|
llvm::sort(ExitingBlocks,
|
||||||
[&](BasicBlock *A, BasicBlock *B) {
|
[&](BasicBlock *A, BasicBlock *B) {
|
||||||
// std::sort sorts in ascending order, so we want the inverse of
|
// std::sort sorts in ascending order, so we want the inverse of
|
||||||
|
@ -2393,7 +2392,7 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
assert(DT->dominates(ExitingBlocks[i-1], ExitingBlocks[i]));
|
assert(DT->dominates(ExitingBlocks[i-1], ExitingBlocks[i]));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
auto FoldExit = [&](BasicBlock *ExitingBB, bool IsTaken) {
|
auto FoldExit = [&](BasicBlock *ExitingBB, bool IsTaken) {
|
||||||
BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
|
BranchInst *BI = cast<BranchInst>(ExitingBB->getTerminator());
|
||||||
bool ExitIfTrue = !L->contains(*succ_begin(ExitingBB));
|
bool ExitIfTrue = !L->contains(*succ_begin(ExitingBB));
|
||||||
|
@ -2410,7 +2409,7 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
for (BasicBlock *ExitingBB : ExitingBlocks) {
|
for (BasicBlock *ExitingBB : ExitingBlocks) {
|
||||||
const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
|
const SCEV *ExitCount = SE->getExitCount(L, ExitingBB);
|
||||||
assert(!isa<SCEVCouldNotCompute>(ExitCount) && "checked above");
|
assert(!isa<SCEVCouldNotCompute>(ExitCount) && "checked above");
|
||||||
|
|
||||||
// If we know we'd exit on the first iteration, rewrite the exit to
|
// If we know we'd exit on the first iteration, rewrite the exit to
|
||||||
// reflect this. This does not imply the loop must exit through this
|
// reflect this. This does not imply the loop must exit through this
|
||||||
// exit; there may be an earlier one taken on the first iteration.
|
// exit; there may be an earlier one taken on the first iteration.
|
||||||
|
@ -2428,13 +2427,13 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
if (!ExitCount->getType()->isIntegerTy() ||
|
if (!ExitCount->getType()->isIntegerTy() ||
|
||||||
!MaxExitCount->getType()->isIntegerTy())
|
!MaxExitCount->getType()->isIntegerTy())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Type *WiderType =
|
Type *WiderType =
|
||||||
SE->getWiderType(MaxExitCount->getType(), ExitCount->getType());
|
SE->getWiderType(MaxExitCount->getType(), ExitCount->getType());
|
||||||
ExitCount = SE->getNoopOrZeroExtend(ExitCount, WiderType);
|
ExitCount = SE->getNoopOrZeroExtend(ExitCount, WiderType);
|
||||||
MaxExitCount = SE->getNoopOrZeroExtend(MaxExitCount, WiderType);
|
MaxExitCount = SE->getNoopOrZeroExtend(MaxExitCount, WiderType);
|
||||||
assert(MaxExitCount->getType() == ExitCount->getType());
|
assert(MaxExitCount->getType() == ExitCount->getType());
|
||||||
|
|
||||||
// Can we prove that some other exit must be taken strictly before this
|
// Can we prove that some other exit must be taken strictly before this
|
||||||
// one?
|
// one?
|
||||||
if (SE->isLoopEntryGuardedByCond(L, CmpInst::ICMP_ULT,
|
if (SE->isLoopEntryGuardedByCond(L, CmpInst::ICMP_ULT,
|
||||||
|
@ -2447,7 +2446,7 @@ bool IndVarSimplify::optimizeLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
// As we run, keep track of which exit counts we've encountered. If we
|
// As we run, keep track of which exit counts we've encountered. If we
|
||||||
// find a duplicate, we've found an exit which would have exited on the
|
// find a duplicate, we've found an exit which would have exited on the
|
||||||
// exiting iteration, but (from the visit order) strictly follows another
|
// exiting iteration, but (from the visit order) strictly follows another
|
||||||
// which does the same and is thus dead.
|
// which does the same and is thus dead.
|
||||||
if (!DominatingExitCounts.insert(ExitCount).second) {
|
if (!DominatingExitCounts.insert(ExitCount).second) {
|
||||||
FoldExit(ExitingBB, false);
|
FoldExit(ExitingBB, false);
|
||||||
Changed = true;
|
Changed = true;
|
||||||
|
@ -2468,22 +2467,20 @@ bool IndVarSimplify::predicateLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
SmallVector<BasicBlock*, 16> ExitingBlocks;
|
SmallVector<BasicBlock*, 16> ExitingBlocks;
|
||||||
L->getExitingBlocks(ExitingBlocks);
|
L->getExitingBlocks(ExitingBlocks);
|
||||||
|
|
||||||
bool Changed = false;
|
|
||||||
|
|
||||||
// Finally, see if we can rewrite our exit conditions into a loop invariant
|
// Finally, see if we can rewrite our exit conditions into a loop invariant
|
||||||
// form. If we have a read-only loop, and we can tell that we must exit down
|
// form. If we have a read-only loop, and we can tell that we must exit down
|
||||||
// a path which does not need any of the values computed within the loop, we
|
// a path which does not need any of the values computed within the loop, we
|
||||||
// can rewrite the loop to exit on the first iteration. Note that this
|
// can rewrite the loop to exit on the first iteration. Note that this
|
||||||
// doesn't either a) tell us the loop exits on the first iteration (unless
|
// doesn't either a) tell us the loop exits on the first iteration (unless
|
||||||
// *all* exits are predicateable) or b) tell us *which* exit might be taken.
|
// *all* exits are predicateable) or b) tell us *which* exit might be taken.
|
||||||
// This transformation looks a lot like a restricted form of dead loop
|
// This transformation looks a lot like a restricted form of dead loop
|
||||||
// elimination, but restricted to read-only loops and without neccesssarily
|
// elimination, but restricted to read-only loops and without neccesssarily
|
||||||
// needing to kill the loop entirely.
|
// needing to kill the loop entirely.
|
||||||
if (!LoopPredication)
|
if (!LoopPredication)
|
||||||
return Changed;
|
return false;
|
||||||
|
|
||||||
if (!SE->hasLoopInvariantBackedgeTakenCount(L))
|
if (!SE->hasLoopInvariantBackedgeTakenCount(L))
|
||||||
return Changed;
|
return false;
|
||||||
|
|
||||||
// Note: ExactBTC is the exact backedge taken count *iff* the loop exits
|
// Note: ExactBTC is the exact backedge taken count *iff* the loop exits
|
||||||
// through *explicit* control flow. We have to eliminate the possibility of
|
// through *explicit* control flow. We have to eliminate the possibility of
|
||||||
|
@ -2492,16 +2489,16 @@ bool IndVarSimplify::predicateLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
if (isa<SCEVCouldNotCompute>(ExactBTC) ||
|
if (isa<SCEVCouldNotCompute>(ExactBTC) ||
|
||||||
!SE->isLoopInvariant(ExactBTC, L) ||
|
!SE->isLoopInvariant(ExactBTC, L) ||
|
||||||
!isSafeToExpand(ExactBTC, *SE))
|
!isSafeToExpand(ExactBTC, *SE))
|
||||||
return Changed;
|
return false;
|
||||||
|
|
||||||
// If we end up with a pointer exit count, bail. It may be unsized.
|
// If we end up with a pointer exit count, bail. It may be unsized.
|
||||||
if (!ExactBTC->getType()->isIntegerTy())
|
if (!ExactBTC->getType()->isIntegerTy())
|
||||||
return Changed;
|
return false;
|
||||||
|
|
||||||
auto BadExit = [&](BasicBlock *ExitingBB) {
|
auto BadExit = [&](BasicBlock *ExitingBB) {
|
||||||
// If our exiting block exits multiple loops, we can only rewrite the
|
// If our exiting block exits multiple loops, we can only rewrite the
|
||||||
// innermost one. Otherwise, we're changing how many times the innermost
|
// innermost one. Otherwise, we're changing how many times the innermost
|
||||||
// loop runs before it exits.
|
// loop runs before it exits.
|
||||||
if (LI->getLoopFor(ExitingBB) != L)
|
if (LI->getLoopFor(ExitingBB) != L)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -2556,18 +2553,18 @@ bool IndVarSimplify::predicateLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
// is complicated and we choose not to for now.
|
// is complicated and we choose not to for now.
|
||||||
for (unsigned i = 1; i < ExitingBlocks.size(); i++)
|
for (unsigned i = 1; i < ExitingBlocks.size(); i++)
|
||||||
if (!DT->dominates(ExitingBlocks[i-1], ExitingBlocks[i]))
|
if (!DT->dominates(ExitingBlocks[i-1], ExitingBlocks[i]))
|
||||||
return Changed;
|
return false;
|
||||||
|
|
||||||
// Given our sorted total order, we know that exit[j] must be evaluated
|
// Given our sorted total order, we know that exit[j] must be evaluated
|
||||||
// after all exit[i] such j > i.
|
// after all exit[i] such j > i.
|
||||||
for (unsigned i = 0, e = ExitingBlocks.size(); i < e; i++)
|
for (unsigned i = 0, e = ExitingBlocks.size(); i < e; i++)
|
||||||
if (BadExit(ExitingBlocks[i])) {
|
if (BadExit(ExitingBlocks[i])) {
|
||||||
ExitingBlocks.resize(i);
|
ExitingBlocks.resize(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ExitingBlocks.empty())
|
if (ExitingBlocks.empty())
|
||||||
return Changed;
|
return false;
|
||||||
|
|
||||||
// We rely on not being able to reach an exiting block on a later iteration
|
// We rely on not being able to reach an exiting block on a later iteration
|
||||||
// then it's statically compute exit count. The implementaton of
|
// then it's statically compute exit count. The implementaton of
|
||||||
|
@ -2589,8 +2586,9 @@ bool IndVarSimplify::predicateLoopExits(Loop *L, SCEVExpander &Rewriter) {
|
||||||
for (auto &I : *BB)
|
for (auto &I : *BB)
|
||||||
// TODO:isGuaranteedToTransfer
|
// TODO:isGuaranteedToTransfer
|
||||||
if (I.mayHaveSideEffects() || I.mayThrow())
|
if (I.mayHaveSideEffects() || I.mayThrow())
|
||||||
return Changed;
|
return false;
|
||||||
|
|
||||||
|
bool Changed = false;
|
||||||
// Finally, do the actual predication for all predicatable blocks. A couple
|
// Finally, do the actual predication for all predicatable blocks. A couple
|
||||||
// of notes here:
|
// of notes here:
|
||||||
// 1) We don't bother to constant fold dominated exits with identical exit
|
// 1) We don't bother to constant fold dominated exits with identical exit
|
||||||
|
@ -2644,7 +2642,6 @@ bool IndVarSimplify::run(Loop *L) {
|
||||||
// We need (and expect!) the incoming loop to be in LCSSA.
|
// We need (and expect!) the incoming loop to be in LCSSA.
|
||||||
assert(L->isRecursivelyLCSSAForm(*DT, *LI) &&
|
assert(L->isRecursivelyLCSSAForm(*DT, *LI) &&
|
||||||
"LCSSA required to run indvars!");
|
"LCSSA required to run indvars!");
|
||||||
bool Changed = false;
|
|
||||||
|
|
||||||
// If LoopSimplify form is not available, stay out of trouble. Some notes:
|
// If LoopSimplify form is not available, stay out of trouble. Some notes:
|
||||||
// - LSR currently only supports LoopSimplify-form loops. Indvars'
|
// - LSR currently only supports LoopSimplify-form loops. Indvars'
|
||||||
|
@ -2663,6 +2660,7 @@ bool IndVarSimplify::run(Loop *L) {
|
||||||
const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L);
|
const SCEV *BackedgeTakenCount = SE->getBackedgeTakenCount(L);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool Changed = false;
|
||||||
// If there are any floating-point recurrences, attempt to
|
// If there are any floating-point recurrences, attempt to
|
||||||
// transform them to use integer recurrences.
|
// transform them to use integer recurrences.
|
||||||
Changed |= rewriteNonIntegerIVs(L);
|
Changed |= rewriteNonIntegerIVs(L);
|
||||||
|
|
Loading…
Reference in New Issue