mirror of
https://github.com/RPCS3/llvm.git
synced 2025-03-06 01:27:08 +00:00
When we delete a dead basic block, see if any of its successors are dead and
delete those as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168829 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0215368887
commit
bf2ad736c7
@ -194,9 +194,19 @@ bool CodeGenPrepare::runOnFunction(Function &F) {
|
||||
WorkList.insert(*II);
|
||||
}
|
||||
|
||||
for (SmallPtrSet<BasicBlock*, 8>::iterator
|
||||
I = WorkList.begin(), E = WorkList.end(); I != E; ++I)
|
||||
DeleteDeadBlock(*I);
|
||||
// Delete the dead blocks and any of their dead successors.
|
||||
while (!WorkList.empty()) {
|
||||
BasicBlock *BB = *WorkList.begin();
|
||||
WorkList.erase(BB);
|
||||
SmallVector<BasicBlock*, 2> Successors(succ_begin(BB), succ_end(BB));
|
||||
|
||||
DeleteDeadBlock(BB);
|
||||
|
||||
for (SmallVectorImpl<BasicBlock*>::iterator
|
||||
II = Successors.begin(), IE = Successors.end(); II != IE; ++II)
|
||||
if (pred_begin(*II) == pred_end(*II))
|
||||
WorkList.insert(*II);
|
||||
}
|
||||
|
||||
// Merge pairs of basic blocks with unconditional branches, connected by
|
||||
// a single edge.
|
||||
|
Loading…
x
Reference in New Issue
Block a user