Add support for removing invoke instructions

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12858 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2004-04-12 05:15:13 +00:00
parent 85eb157d96
commit 1708d12916

View File

@ -168,6 +168,13 @@ void GCSE::ReplaceInstructionWith(Instruction *I, Value *V) {
if (!isa<Constant>(V)) {
I->replaceAllUsesWith(V);
if (InvokeInst *II = dyn_cast<InvokeInst>(I)) {
// Removing an invoke instruction requires adding a branch to the normal
// destination and removing PHI node entries in the exception destination.
new BranchInst(II->getNormalDest(), II);
II->getUnwindDest()->removePredecessor(II->getParent());
}
// Erase the instruction from the program.
I->getParent()->getInstList().erase(I);
return;
@ -179,6 +186,13 @@ void GCSE::ReplaceInstructionWith(Instruction *I, Value *V) {
// Perform the replacement.
I->replaceAllUsesWith(C);
if (InvokeInst *II = dyn_cast<InvokeInst>(I)) {
// Removing an invoke instruction requires adding a branch to the normal
// destination and removing PHI node entries in the exception destination.
new BranchInst(II->getNormalDest(), II);
II->getUnwindDest()->removePredecessor(II->getParent());
}
// Erase the instruction from the program.
I->getParent()->getInstList().erase(I);