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 | 8525ebe4658302ee90c12fefb6c73b9a0c6f4315 (patch) | |
| tree | 77ca33b1e54f20cacf64146e8730a9ee7af1a8a0 /llvm/lib/Transforms | |
| parent | b3095dd88fca220bcda1d213cdd64e392945c834 (diff) | |
| download | bcm5719-llvm-8525ebe4658302ee90c12fefb6c73b9a0c6f4315.tar.gz bcm5719-llvm-8525ebe4658302ee90c12fefb6c73b9a0c6f4315.zip | |
Do not delete the entry block to a function.
llvm-svn: 18795
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/SCCP.cpp | 6 | 
1 files changed, 5 insertions, 1 deletions
| diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp index 9a8d26bb7b8..7682e5a9e18 100644 --- a/llvm/lib/Transforms/Scalar/SCCP.cpp +++ b/llvm/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++; | 

