diff options
author | Owen Anderson <resistor@mac.com> | 2008-08-05 00:30:10 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-08-05 00:30:10 +0000 |
commit | 59c0d4fcde6f112dd8e83293c6aa6b7138a05424 (patch) | |
tree | 5c771678c5512d8b3d86285428cb0f31f5c4f4d7 /lib/CodeGen/UnreachableBlockElim.cpp | |
parent | 6ac8df7f611b5b129af7192ad931862fc8169aae (diff) | |
download | external_llvm-59c0d4fcde6f112dd8e83293c6aa6b7138a05424.zip external_llvm-59c0d4fcde6f112dd8e83293c6aa6b7138a05424.tar.gz external_llvm-59c0d4fcde6f112dd8e83293c6aa6b7138a05424.tar.bz2 |
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
Diffstat (limited to 'lib/CodeGen/UnreachableBlockElim.cpp')
-rw-r--r-- | lib/CodeGen/UnreachableBlockElim.cpp | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/CodeGen/UnreachableBlockElim.cpp b/lib/CodeGen/UnreachableBlockElim.cpp index 8286239..19341ee 100644 --- a/lib/CodeGen/UnreachableBlockElim.cpp +++ b/lib/CodeGen/UnreachableBlockElim.cpp @@ -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(); } |