From: Chris Lattner Date: Sat, 22 Nov 2003 02:13:08 +0000 (+0000) Subject: Do not crash when deleing a region with a dead invoke instruction X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c8ecd22037d4e72ca8e3757c09095b830502cc5a;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index 4d7efd8ae4d..a06e746b0e0 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 ?