forked from OSchip/llvm-project
[SCEV] Revert two speculative compile time optimizations which made no difference
Revert "[SCEV] Defer all work fromea12c2cb
as late as possible" Revert "[SCEV] Defer loop property checks fromea12c2cb
as late as possible" This reverts commit734abbad79
and1a5666acb2
. Both of these changes were speculative attempts to address a compile time regression. Neither worked, and both complicated the code in undesirable ways.
This commit is contained in:
parent
af57a71d18
commit
28000587e1
|
@ -8321,14 +8321,8 @@ ScalarEvolution::computeExitLimitFromICmp(const Loop *L,
|
|||
// the same values on self-wrap of the IV, then we can infer that IV
|
||||
// doesn't self wrap because if it did, we'd have an infinite (undefined)
|
||||
// loop.
|
||||
if (ControlsExit) {
|
||||
auto deferredLoopProperties = [&]() {
|
||||
// Conceptually, these two checks should be in the immediately guarding
|
||||
// if clause, but we defer their actual execution to after the cheaper
|
||||
// checks have all been done.
|
||||
return isLoopInvariant(RHS, L) && loopHasNoAbnormalExits(L) &&
|
||||
loopIsFiniteByAssumption(L);
|
||||
};
|
||||
if (ControlsExit && isLoopInvariant(RHS, L) && loopHasNoAbnormalExits(L) &&
|
||||
loopIsFiniteByAssumption(L)) {
|
||||
|
||||
// TODO: We can peel off any functions which are invertible *in L*. Loop
|
||||
// invariant terms are effectively constants for our purposes here.
|
||||
|
@ -8336,16 +8330,14 @@ ScalarEvolution::computeExitLimitFromICmp(const Loop *L,
|
|||
if (auto *ZExt = dyn_cast<SCEVZeroExtendExpr>(LHS))
|
||||
InnerLHS = ZExt->getOperand();
|
||||
if (const SCEVAddRecExpr *AR = dyn_cast<SCEVAddRecExpr>(InnerLHS)) {
|
||||
if (!AR->hasNoSelfWrap() && AR->getLoop() == L && AR->isAffine()) {
|
||||
auto *StrideC = dyn_cast<SCEVConstant>(AR->getStepRecurrence(*this));
|
||||
if (StrideC && StrideC->getAPInt().isPowerOf2() &&
|
||||
deferredLoopProperties()) {
|
||||
auto Flags = AR->getNoWrapFlags();
|
||||
Flags = setFlags(Flags, SCEV::FlagNW);
|
||||
SmallVector<const SCEV*> Operands{AR->operands()};
|
||||
Flags = StrengthenNoWrapFlags(this, scAddRecExpr, Operands, Flags);
|
||||
setNoWrapFlags(const_cast<SCEVAddRecExpr *>(AR), Flags);
|
||||
}
|
||||
auto *StrideC = dyn_cast<SCEVConstant>(AR->getStepRecurrence(*this));
|
||||
if (!AR->hasNoSelfWrap() && AR->getLoop() == L && AR->isAffine() &&
|
||||
StrideC && StrideC->getAPInt().isPowerOf2()) {
|
||||
auto Flags = AR->getNoWrapFlags();
|
||||
Flags = setFlags(Flags, SCEV::FlagNW);
|
||||
SmallVector<const SCEV*> Operands{AR->operands()};
|
||||
Flags = StrengthenNoWrapFlags(this, scAddRecExpr, Operands, Flags);
|
||||
setNoWrapFlags(const_cast<SCEVAddRecExpr *>(AR), Flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue