1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 04:02:41 +01:00

DeleteTriviallyDeadInstructions is always passed the

DeadInsts ivar, just use it directly.

llvm-svn: 60330
This commit is contained in:
Chris Lattner 2008-12-01 06:14:28 +00:00
parent d6be279b4d
commit db86ff62f9

View File

@ -205,7 +205,7 @@ private:
void StrengthReduceStridedIVUsers(const SCEVHandle &Stride, void StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
IVUsersOfOneStride &Uses, IVUsersOfOneStride &Uses,
Loop *L, bool isOnlyStride); Loop *L, bool isOnlyStride);
void DeleteTriviallyDeadInstructions(SetVector<Instruction*> &Insts); void DeleteTriviallyDeadInstructions();
}; };
} }
@ -238,11 +238,10 @@ Value *LoopStrengthReduce::getCastedVersionOf(Instruction::CastOps opcode,
/// DeleteTriviallyDeadInstructions - If any of the instructions is the /// DeleteTriviallyDeadInstructions - If any of the instructions is the
/// specified set are trivially dead, delete them and see if this makes any of /// specified set are trivially dead, delete them and see if this makes any of
/// their operands subsequently dead. /// their operands subsequently dead.
void LoopStrengthReduce:: void LoopStrengthReduce::DeleteTriviallyDeadInstructions() {
DeleteTriviallyDeadInstructions(SetVector<Instruction*> &Insts) { while (!DeadInsts.empty()) {
while (!Insts.empty()) { Instruction *I = DeadInsts.back();
Instruction *I = Insts.back(); DeadInsts.pop_back();
Insts.pop_back();
if (!isInstructionTriviallyDead(I)) if (!isInstructionTriviallyDead(I))
continue; continue;
@ -253,7 +252,7 @@ DeleteTriviallyDeadInstructions(SetVector<Instruction*> &Insts) {
if (Instruction *U = dyn_cast<Instruction>(*i)) { if (Instruction *U = dyn_cast<Instruction>(*i)) {
*i = 0; *i = 0;
if (U->use_empty()) if (U->use_empty())
Insts.insert(U); DeadInsts.insert(U);
} }
} }
@ -1441,7 +1440,7 @@ void LoopStrengthReduce::StrengthReduceStridedIVUsers(const SCEVHandle &Stride,
Rewriter, L, this, Rewriter, L, this,
DeadInsts); DeadInsts);
// Mark old value we replaced as possibly dead, so that it is elminated // Mark old value we replaced as possibly dead, so that it is eliminated
// if we just replaced the last use of that value. // if we just replaced the last use of that value.
DeadInsts.insert(cast<Instruction>(User.OperandValToReplace)); DeadInsts.insert(cast<Instruction>(User.OperandValToReplace));
@ -2055,7 +2054,7 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) {
// Clean up after ourselves // Clean up after ourselves
if (!DeadInsts.empty()) { if (!DeadInsts.empty()) {
DeleteTriviallyDeadInstructions(DeadInsts); DeleteTriviallyDeadInstructions();
BasicBlock::iterator I = L->getHeader()->begin(); BasicBlock::iterator I = L->getHeader()->begin();
while (PHINode *PN = dyn_cast<PHINode>(I++)) { while (PHINode *PN = dyn_cast<PHINode>(I++)) {
@ -2091,7 +2090,7 @@ bool LoopStrengthReduce::runOnLoop(Loop *L, LPPassManager &LPM) {
break; break;
} }
} }
DeleteTriviallyDeadInstructions(DeadInsts); DeleteTriviallyDeadInstructions();
} }
return Changed; return Changed;
} }