projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0d6c5b6
)
If a block is made dead, make sure to promptly remove it.
author
Chris Lattner
<sabre@nondot.org>
Tue, 24 Feb 2004 16:09:21 +0000
(16:09 +0000)
committer
Chris Lattner
<sabre@nondot.org>
Tue, 24 Feb 2004 16:09:21 +0000
(16:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11799
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
patch
|
blob
|
history
diff --git
a/lib/Transforms/Utils/SimplifyCFG.cpp
b/lib/Transforms/Utils/SimplifyCFG.cpp
index 15124003d24f299f4db7d0d85e02d9c5a604bbac..ca59276f2b7d88c3f90a27302a3dec9d9d70fbce 100644
(file)
--- a/
lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/
lib/Transforms/Utils/SimplifyCFG.cpp
@@
-512,6
+512,14
@@
bool llvm::SimplifyCFG(BasicBlock *BB) {
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.