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

Chris Lattner lattner at cs.uiuc.edu
Fri Nov 21 20:14:01 PST 2003


Changes in directory llvm/lib/Transforms/Scalar:

ADCE.cpp updated: 1.68 -> 1.69

---
Log message:

Do not crash when deleing a region with a dead invoke instruction


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

Index: llvm/lib/Transforms/Scalar/ADCE.cpp
diff -u llvm/lib/Transforms/Scalar/ADCE.cpp:1.68 llvm/lib/Transforms/Scalar/ADCE.cpp:1.69
--- llvm/lib/Transforms/Scalar/ADCE.cpp:1.68	Fri Nov 21 10:52:01 2003
+++ llvm/lib/Transforms/Scalar/ADCE.cpp	Fri Nov 21 20:13:08 2003
@@ -430,6 +430,10 @@
         }
         
         // Delete the old terminator instruction...
+        const Type *TermTy = BB->getTerminator()->getType();
+        if (TermTy != Type::VoidTy)
+          BB->getTerminator()->replaceAllUsesWith(
+                               Constant::getNullValue(TermTy));
         BB->getInstList().pop_back();
         const Type *RetTy = Func->getReturnType();
         new ReturnInst(RetTy != Type::VoidTy ?





More information about the llvm-commits mailing list