diff options
author | Chris Lattner <sabre@nondot.org> | 2004-04-12 05:15:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-04-12 05:15:13 +0000 |
commit | 1708d1291633ed41a89caba8dc493203fdeaaa45 (patch) | |
tree | 891bbe8b7fafcfc141aa02cac79a7bc6492dd3ea /lib/Transforms | |
parent | 85eb157d966c6015262ec0d7f0353c7f416dee7b (diff) | |
download | external_llvm-1708d1291633ed41a89caba8dc493203fdeaaa45.zip external_llvm-1708d1291633ed41a89caba8dc493203fdeaaa45.tar.gz external_llvm-1708d1291633ed41a89caba8dc493203fdeaaa45.tar.bz2 |
Add support for removing invoke instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/GCSE.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/GCSE.cpp b/lib/Transforms/Scalar/GCSE.cpp index bbefe81..7db7d4d 100644 --- a/lib/Transforms/Scalar/GCSE.cpp +++ b/lib/Transforms/Scalar/GCSE.cpp @@ -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); |