From 545a76ced84bc327d4c5c32415a98eeb5b1159c2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 10 Sep 2003 20:38:14 +0000 Subject: [PATCH] Unwind instructions are intrinsically alive, just like returns git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@8462 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/ADCE.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Transforms/Scalar/ADCE.cpp b/lib/Transforms/Scalar/ADCE.cpp index ffb57d0d6ae..0efdbf4b0f6 100644 --- a/lib/Transforms/Scalar/ADCE.cpp +++ b/lib/Transforms/Scalar/ADCE.cpp @@ -84,8 +84,8 @@ private: } inline void markTerminatorLive(const BasicBlock *BB) { - DEBUG(std::cerr << "Terminat Live: " << BB->getTerminator()); - markInstructionLive((Instruction*)BB->getTerminator()); + DEBUG(std::cerr << "Terminator Live: " << BB->getTerminator()); + markInstructionLive(const_cast(BB->getTerminator())); } }; @@ -176,7 +176,7 @@ bool ADCE::doADCE() { BBI != BBE; ++BBI) { BasicBlock *BB = *BBI; for (BasicBlock::iterator II = BB->begin(), EI = BB->end(); II != EI; ) { - if (II->mayWriteToMemory() || II->getOpcode() == Instruction::Ret) { + if (II->mayWriteToMemory() || isa(II) || isa(II)){ markInstructionLive(II); ++II; // Increment the inst iterator if the inst wasn't deleted } else if (isInstructionTriviallyDead(II)) {