[llvm-commits] [llvm] r51668 - in /llvm/trunk: lib/Transforms/Scalar/ADCE.cpp test/Transforms/ADCE/2003-12-19-MergeReturn.ll test/Transforms/ADCE/dead-phi-edge.ll

Chris Lattner clattner at apple.com
Fri Jun 20 13:42:15 PDT 2008


On May 29, 2008, at 1:45 AM, Owen Anderson wrote:

> Author: resistor
> Date: Thu May 29 03:45:13 2008
> New Revision: 51668
>
> URL: http://llvm.org/viewvc/llvm-project?rev=51668&view=rev
> Log:
> Replace the old ADCE implementation with a new one that more simply  
> solves
> the one case that ADCE catches that normal DCE doesn't: non- 
> induction variable
> loop computations.

The new implementation is significantly simpler than the old one :).   
Some thoughts:

It is reasonable to make these large in-place structures:
   SmallPtrSet<Instruction*, 32> alive;
   std::vector<Instruction*> worklist;

I'd suggest 1024 and a smallvector<1024> for the worklist.


   // The inverse of the live set is the dead set.  These are those  
instructions
   // which have no side effects and do not influence the control flow  
or return
   // value of the function, and may therefore be deleted safely.
   SmallPtrSet<Instruction*, 32> dead;

There is no need for this to be a set, just use a vector.  Why not the  
worklist? :)

Otherwise, looks great Owen, thanks!

-chris



More information about the llvm-commits mailing list