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

Evan Cheng evan.cheng at apple.com
Mon Aug 4 18:25:25 PDT 2008


Can you take a look at BranchFolding and see if it's possible to fold  
this pass into BranchFolding? (I think it is.) Perhaps we can run it  
twice, the first time just clean up the function without doing any  
tail duplication?

Evan

On Aug 4, 2008, at 5:30 PM, Owen Anderson wrote:

> 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();
> }
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list