mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-01 08:28:19 +00:00
Avoid inserting an entry block unless we need it
llvm-svn: 3336
This commit is contained in:
parent
2f101c0f0e
commit
80b897953e
@ -235,11 +235,15 @@ bool ADCE::doADCE() {
|
||||
dropReferencesOfDeadInstructionsInLiveBlock(I);
|
||||
|
||||
} else { // If there are some blocks dead...
|
||||
// Insert a new entry node to eliminate the entry node as a special case.
|
||||
BasicBlock *NewEntry = new BasicBlock();
|
||||
NewEntry->getInstList().push_back(new BranchInst(&Func->front()));
|
||||
Func->getBasicBlockList().push_front(NewEntry);
|
||||
AliveBlocks.insert(NewEntry); // This block is always alive!
|
||||
// If the entry node is dead, insert a new entry node to eliminate the entry
|
||||
// node as a special case.
|
||||
//
|
||||
if (!AliveBlocks.count(&Func->front())) {
|
||||
BasicBlock *NewEntry = new BasicBlock();
|
||||
NewEntry->getInstList().push_back(new BranchInst(&Func->front()));
|
||||
Func->getBasicBlockList().push_front(NewEntry);
|
||||
AliveBlocks.insert(NewEntry); // This block is always alive!
|
||||
}
|
||||
|
||||
// Loop over all of the alive blocks in the function. If any successor
|
||||
// blocks are not alive, we adjust the outgoing branches to branch to the
|
||||
|
Loading…
Reference in New Issue
Block a user