[llvm-commits] CVS: llvm/lib/Transforms/Scalar/GCSE.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Apr 12 00:16:11 PDT 2004


Changes in directory llvm/lib/Transforms/Scalar:

GCSE.cpp updated: 1.38 -> 1.39

---
Log message:

Add support for removing invoke instructions


---
Diffs of the changes:  (+14 -0)

Index: llvm/lib/Transforms/Scalar/GCSE.cpp
diff -u llvm/lib/Transforms/Scalar/GCSE.cpp:1.38 llvm/lib/Transforms/Scalar/GCSE.cpp:1.39
--- llvm/lib/Transforms/Scalar/GCSE.cpp:1.38	Sat Apr 10 17:33:34 2004
+++ llvm/lib/Transforms/Scalar/GCSE.cpp	Mon Apr 12 00:15:13 2004
@@ -167,6 +167,13 @@
   // 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);
@@ -178,6 +185,13 @@
 
   // 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);





More information about the llvm-commits mailing list