aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Transforms/Scalar/ADCE.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-22 02:13:08 +0000
committerChris Lattner <sabre@nondot.org>2003-11-22 02:13:08 +0000
commitc8ecd22037d4e72ca8e3757c09095b830502cc5a (patch)
tree9efb06680adf48595a197653f6a01bb171a560fc /lib/Transforms/Scalar/ADCE.cpp
parent8bc098be0cce48dcc08fea746d28011cac79eef6 (diff)
downloadexternal_llvm-c8ecd22037d4e72ca8e3757c09095b830502cc5a.zip
external_llvm-c8ecd22037d4e72ca8e3757c09095b830502cc5a.tar.gz
external_llvm-c8ecd22037d4e72ca8e3757c09095b830502cc5a.tar.bz2
Do not crash when deleing a region with a dead invoke instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10161 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/ADCE.cpp')
-rw-r--r--lib/Transforms/Scalar/ADCE.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp
index 4d7efd8..a06e746 100644
--- a/lib/Transforms/Scalar/ADCE.cpp
+++ b/lib/Transforms/Scalar/ADCE.cpp
@@ -430,6 +430,10 @@ bool ADCE::doADCE() {
}
// 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 ?