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:
Owen Anderson 2008-08-05 00:30:10 +00:00
parent 6ac8df7f61
commit 59c0d4fcde

View File

@ -85,7 +85,6 @@ namespace {
class VISIBILITY_HIDDEN UnreachableMachineBlockElim :
public MachineFunctionPass {
virtual bool runOnMachineFunction(MachineFunction &F);
bool iterateOnFunction(MachineFunction& F);
public:
static char ID; // Pass identification, replacement for typeid
@ -101,21 +100,6 @@ Y("unreachable-mbb-elimination",
const PassInfo *const llvm::UnreachableMachineBlockElimID = &Y;
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;
// Mark all reachable blocks.
@ -160,6 +144,8 @@ bool UnreachableMachineBlockElim::iterateOnFunction(MachineFunction &F) {
for (unsigned i = 0, e = DeadBlocks.size(); i != e; ++i)
DeadBlocks[i]->eraseFromParent();
F.RenumberBlocks();
return DeadBlocks.size();
}