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 | 7a5d914f5c4e8860dfa5c68c156e560d1fa38fea (patch) | |
tree | 5c771678c5512d8b3d86285428cb0f31f5c4f4d7 | |
parent | c55989acf9cd3d4eef3448e082e935a5324b36f1 (diff) | |
download | external_llvm-7a5d914f5c4e8860dfa5c68c156e560d1fa38fea.tar.gz external_llvm-7a5d914f5c4e8860dfa5c68c156e560d1fa38fea.tar.bz2 external_llvm-7a5d914f5c4e8860dfa5c68c156e560d1fa38fea.zip |
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
-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 8286239096..19341ee721 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(); } |