[llvm-commits] [llvm] r53034 - /llvm/trunk/lib/Transforms/Scalar/ADCE.cpp

Chris Lattner clattner at apple.com
Wed Jul 2 11:05:54 PDT 2008


On Jul 2, 2008, at 10:32 AM, Owen Anderson wrote:

> Author: resistor
> Date: Wed Jul  2 12:32:04 2008
> New Revision: 53034
>
> URL: http://llvm.org/viewvc/llvm-project?rev=53034&view=rev
> Log:
> Use DenseSet rather than SmallPtrSet for the alive set.  Using  
> SmallPtrSet
> with a huge "size" parameter is actually quite inefficient.

Huh?  How is it slow?  The slow part would be when the ctor runs  
because it has to memset out a set of 1024 elements.  Have you tried  
changing it to be SmallPtrSet<x,64> or something?

When you exceed the size of the small set, it does use an efficient  
set for the pointers: more efficient than denseset.

-Chris

>
>
> Modified:
>    llvm/trunk/lib/Transforms/Scalar/ADCE.cpp
>
> Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=53034&r1=53033&r2=53034&view=diff
>
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> = 
> ======================================================================
> --- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original)
> +++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Wed Jul  2 12:32:04 2008
> @@ -21,7 +21,7 @@
> #include "llvm/Support/Compiler.h"
> #include "llvm/Support/InstIterator.h"
> #include "llvm/ADT/Statistic.h"
> -#include "llvm/ADT/SmallPtrSet.h"
> +#include "llvm/ADT/DenseSet.h"
> #include "llvm/ADT/SmallVector.h"
>
> using namespace llvm;
> @@ -33,7 +33,7 @@
>     static char ID; // Pass identification, replacement for typeid
>     ADCE() : FunctionPass((intptr_t)&ID) {}
>
> -    SmallPtrSet<Instruction*, 1024> alive;
> +    DenseSet<Instruction*> alive;
>     SmallVector<Instruction*, 1024> worklist;
>
>     virtual bool runOnFunction(Function& F);
>
>
> _______________________________________________
> 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