don't put erase or query for non-allocainst pointers in an set of allocainsts*'s

llvm-svn: 43779
This commit is contained in:
Chris Lattner 2007-11-06 22:07:22 +00:00
parent f76f2b0c1c
commit cbad11e027
1 changed files with 6 additions and 3 deletions

View File

@ -271,7 +271,8 @@ bool DSE::handleEndBlock(BasicBlock& BB,
// See through pointer-to-pointer bitcasts // See through pointer-to-pointer bitcasts
TranslatePointerBitCasts(pointerOperand); TranslatePointerBitCasts(pointerOperand);
if (deadPointers.count(pointerOperand)){ if (isa<AllocaInst>(pointerOperand) &&
deadPointers.count(cast<AllocaInst>(pointerOperand))) {
// Remove it! // Remove it!
MD.removeInstruction(S); MD.removeInstruction(S);
@ -345,7 +346,8 @@ bool DSE::handleEndBlock(BasicBlock& BB,
for (std::vector<Instruction*>::iterator I = dead.begin(), E = dead.end(); for (std::vector<Instruction*>::iterator I = dead.begin(), E = dead.end();
I != E; ++I) I != E; ++I)
deadPointers.erase(*I); if (AllocaInst *AI = dyn_cast<AllocaInst>(*I))
deadPointers.erase(AI);
continue; continue;
} }
@ -427,7 +429,8 @@ bool DSE::RemoveUndeadPointers(Value* killPointer,
for (std::vector<Instruction*>::iterator I = undead.begin(), E = undead.end(); for (std::vector<Instruction*>::iterator I = undead.begin(), E = undead.end();
I != E; ++I) I != E; ++I)
deadPointers.erase(*I); if (AllocaInst *AI = dyn_cast<AllocaInst>(*I))
deadPointers.erase(AI);
return MadeChange; return MadeChange;
} }