mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-07 11:33:44 +00:00
Remove unneeded iteration. Thanks to Dan for the feedback.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@54337 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6ac8df7f61
commit
59c0d4fcde
@ -85,7 +85,6 @@ namespace {
|
|||||||
class VISIBILITY_HIDDEN UnreachableMachineBlockElim :
|
class VISIBILITY_HIDDEN UnreachableMachineBlockElim :
|
||||||
public MachineFunctionPass {
|
public MachineFunctionPass {
|
||||||
virtual bool runOnMachineFunction(MachineFunction &F);
|
virtual bool runOnMachineFunction(MachineFunction &F);
|
||||||
bool iterateOnFunction(MachineFunction& F);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
@ -101,21 +100,6 @@ Y("unreachable-mbb-elimination",
|
|||||||
const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y;
|
const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y;
|
||||||
|
|
||||||
bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
bool UnreachableMachineBlockElim::runOnMachineFunction(MachineFunction &F) {
|
||||||
bool changed = true;
|
|
||||||
bool result = false;
|
|
||||||
|
|
||||||
while (changed) {
|
|
||||||
changed = iterateOnFunction(F);
|
|
||||||
result |= changed;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result)
|
|
||||||
F.RenumberBlocks();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool UnreachableMachineBlockElim::iterateOnFunction(MachineFunction &F) {
|
|
||||||
std::set<MachineBasicBlock*> Reachable;
|
std::set<MachineBasicBlock*> Reachable;
|
||||||
|
|
||||||
// Mark all reachable blocks.
|
// Mark all reachable blocks.
|
||||||
@ -160,6 +144,8 @@ bool UnreachableMachineBlockElim::iterateOnFunction(MachineFunction &F) {
|
|||||||
for (unsigned i = 0, e = DeadBlocks.size(); i != e; ++i)
|
for (unsigned i = 0, e = DeadBlocks.size(); i != e; ++i)
|
||||||
DeadBlocks[i]->eraseFromParent();
|
DeadBlocks[i]->eraseFromParent();
|
||||||
|
|
||||||
|
F.RenumberBlocks();
|
||||||
|
|
||||||
return DeadBlocks.size();
|
return DeadBlocks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user