mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
If a block is made dead, make sure to promptly remove it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11799 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0d6c5b6489
commit
8e509dd5e8
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user