[llvm-commits] [llvm] r54337 - /llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp

Owen Anderson resistor at mac.com
Mon Aug 4 17:30:10 PDT 2008


Author: resistor
Date: Mon Aug  4 19:30:10 2008
New Revision: 54337

URL: http://llvm.org/viewvc/llvm-project?rev=54337&view=rev
Log:
Remove unneeded iteration.  Thanks to Dan for the feedback.

Modified:
    llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp

Modified: llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp?rev=54337&r1=54336&r2=54337&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp (original)
+++ llvm/trunk/lib/CodeGen/UnreachableBlockElim.cpp Mon Aug  4 19:30:10 2008
@@ -85,7 +85,6 @@
   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 @@
 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 @@
   for (unsigned i = 0, e = DeadBlocks.size(); i != e; ++i)
     DeadBlocks[i]->eraseFromParent();
 
+  F.RenumberBlocks();
+
   return DeadBlocks.size();
 }
 





More information about the llvm-commits mailing list