mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-13 07:00:59 +00:00
Add support for removing invoke instructions
llvm-svn: 12858
This commit is contained in:
parent
af22e5f826
commit
603d821596
@ -167,6 +167,13 @@ void GCSE::ReplaceInstructionWith(Instruction *I, Value *V) {
|
||||
// anything special.
|
||||
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);
|
||||
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user