[llvm-commits] CVS: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Feb 24 10:10:04 PST 2004
Changes in directory llvm/lib/Transforms/Utils:
SimplifyCFG.cpp updated: 1.26 -> 1.27
---
Log message:
If a block is made dead, make sure to promptly remove it.
---
Diffs of the changes: (+8 -0)
Index: llvm/lib/Transforms/Utils/SimplifyCFG.cpp
diff -u llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.26 llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.27
--- llvm/lib/Transforms/Utils/SimplifyCFG.cpp:1.26 Tue Feb 24 01:23:58 2004
+++ llvm/lib/Transforms/Utils/SimplifyCFG.cpp Tue Feb 24 10:09:21 2004
@@ -512,6 +512,14 @@
Preds.pop_back();
}
+
+ // If this block is now dead, remove it.
+ if (pred_begin(BB) == pred_end(BB)) {
+ // We know there are no successors, so just nuke the block.
+ M->getBasicBlockList().erase(BB);
+ return true;
+ }
+
} else if (SwitchInst *SI = dyn_cast<SwitchInst>(BB->begin())) {
// If the only instruction in this block is a switch instruction, see if we
// can fold the switch instruction into a switch in a predecessor block.
More information about the llvm-commits
mailing list