[llvm-commits] CVS: llvm/lib/Transforms/Scalar/SCCP.cpp
Chris Lattner
lattner at cs.uiuc.edu
Fri Dec 10 21:32:34 PST 2004
Changes in directory llvm/lib/Transforms/Scalar:
SCCP.cpp updated: 1.116 -> 1.117
---
Log message:
Do not delete the entry block to a function.
---
Diffs of the changes: (+5 -1)
Index: llvm/lib/Transforms/Scalar/SCCP.cpp
diff -u llvm/lib/Transforms/Scalar/SCCP.cpp:1.116 llvm/lib/Transforms/Scalar/SCCP.cpp:1.117
--- llvm/lib/Transforms/Scalar/SCCP.cpp:1.116 Fri Dec 10 23:15:59 2004
+++ llvm/lib/Transforms/Scalar/SCCP.cpp Fri Dec 10 23:32:19 2004
@@ -1178,7 +1178,6 @@
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 @@
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++;
More information about the llvm-commits
mailing list