mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-16 12:24:03 +00:00
Use RecursivelyDeleteTriviallyDeadInstructions in EliminateIVComparisons,
instead of deleting just the user. This makes it more consistent with other code in IndVarSimplify, and theoretically can eliminate more users earlier. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101027 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -338,9 +338,11 @@ void IndVarSimplify::RewriteNonIntegerIVs(Loop *L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void IndVarSimplify::EliminateIVComparisons() {
|
void IndVarSimplify::EliminateIVComparisons() {
|
||||||
|
SmallVector<WeakVH, 16> DeadInsts;
|
||||||
|
|
||||||
// Look for ICmp users.
|
// Look for ICmp users.
|
||||||
for (IVUsers::iterator I = IU->begin(), E = IU->end(); I != E;) {
|
for (IVUsers::iterator I = IU->begin(), E = IU->end(); I != E; ++I) {
|
||||||
IVStrideUse &UI = *I++;
|
IVStrideUse &UI = *I;
|
||||||
ICmpInst *ICmp = dyn_cast<ICmpInst>(UI.getUser());
|
ICmpInst *ICmp = dyn_cast<ICmpInst>(UI.getUser());
|
||||||
if (!ICmp) continue;
|
if (!ICmp) continue;
|
||||||
|
|
||||||
@ -367,8 +369,15 @@ void IndVarSimplify::EliminateIVComparisons() {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n');
|
DEBUG(dbgs() << "INDVARS: Eliminated comparison: " << *ICmp << '\n');
|
||||||
ICmp->eraseFromParent();
|
DeadInsts.push_back(ICmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now that we're done iterating through lists, clean up any instructions
|
||||||
|
// which are now dead.
|
||||||
|
while (!DeadInsts.empty())
|
||||||
|
if (Instruction *Inst =
|
||||||
|
dyn_cast_or_null<Instruction>(DeadInsts.pop_back_val()))
|
||||||
|
RecursivelyDeleteTriviallyDeadInstructions(Inst);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
bool IndVarSimplify::runOnLoop(Loop *L, LPPassManager &LPM) {
|
||||||
|
Reference in New Issue
Block a user