mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-11 11:34:02 +00:00
indvars: Added verification that LFTR and other indvars goodness does
not interfere with BackedgeTakenCount computation. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135412 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5241b79ebc
commit
f6a0dbaaf4
@ -1900,6 +1900,25 @@ bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||
// Clean up dead instructions.
|
||||
Changed |= DeleteDeadPHIs(L->getHeader());
|
||||
// Check a post-condition.
|
||||
assert(L->isLCSSAForm(*DT) && "Indvars did not leave the loop in lcssa form!");
|
||||
assert(L->isLCSSAForm(*DT) &&
|
||||
"Indvars did not leave the loop in lcssa form!");
|
||||
|
||||
// Verify that LFTR, and any other change have not interfered with SCEV's
|
||||
// ability to compute trip count.
|
||||
#ifndef NDEBUG
|
||||
if (DisableIVRewrite && !isa<SCEVCouldNotCompute>(BackedgeTakenCount)) {
|
||||
SE->forgetLoop(L);
|
||||
const SCEV *NewBECount = SE->getBackedgeTakenCount(L);
|
||||
if (SE->getTypeSizeInBits(BackedgeTakenCount->getType()) <
|
||||
SE->getTypeSizeInBits(NewBECount->getType()))
|
||||
NewBECount = SE->getTruncateOrNoop(NewBECount,
|
||||
BackedgeTakenCount->getType());
|
||||
else
|
||||
BackedgeTakenCount = SE->getTruncateOrNoop(BackedgeTakenCount,
|
||||
NewBECount->getType());
|
||||
assert(BackedgeTakenCount == NewBECount && "indvars must preserve SCEV");
|
||||
}
|
||||
#endif
|
||||
|
||||
return Changed;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user