diff options
author | Chris Lattner <sabre@nondot.org> | 2004-12-11 05:32:19 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-12-11 05:32:19 +0000 |
commit | 864737bf9e208566bbecb81dda9cce5245fa2bcf (patch) | |
tree | de321008dececfb370f38498883227307824e007 /lib | |
parent | 56c5d7369bc06aa7555cc5436aeef4f3ae565fa4 (diff) | |
download | external_llvm-864737bf9e208566bbecb81dda9cce5245fa2bcf.zip external_llvm-864737bf9e208566bbecb81dda9cce5245fa2bcf.tar.gz external_llvm-864737bf9e208566bbecb81dda9cce5245fa2bcf.tar.bz2 |
Do not delete the entry block to a function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18795 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/Scalar/SCCP.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp index 9a8d26b..7682e5a 100644 --- a/lib/Transforms/Scalar/SCCP.cpp +++ b/lib/Transforms/Scalar/SCCP.cpp @@ -1178,7 +1178,6 @@ bool IPSCCP::runOnModule(Module &M) { if (!ExecutableBBs.count(BB)) { DEBUG(std::cerr << " BasicBlock Dead:" << *BB); ++IPNumDeadBlocks; - BlocksToErase.push_back(BB); // Delete the instructions backwards, as it has a reduced likelihood of // having to update as many def-use and use-def chains. @@ -1206,6 +1205,11 @@ bool IPSCCP::runOnModule(Module &M) { TI->replaceAllUsesWith(UndefValue::get(TI->getType())); BB->getInstList().erase(TI); + if (&*BB != &F->front()) + BlocksToErase.push_back(BB); + else + new UnreachableInst(BB); + } else { for (BasicBlock::iterator BI = BB->begin(), E = BB->end(); BI != E; ) { Instruction *Inst = BI++; |