This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: IPA Constant Propagation Optimization


Razya Ladelsky wrote:
> Following our message ( http://gcc.gnu.org/ml/gcc/2003-11/msg01243.html )
> regarding IPA constant propagation, we enclose the first draft
> of the optimization.

If you're interested in IPCP, you might want to check out the LLVM
implementation.  It's a very simple algorithm that doesn't modify
functions whose addresses are taken, but is quite effective, trivially
fast, and is only 80 SLOC of code:

http://llvm.cs.uiuc.edu/doxygen/IPConstantPropagation_8cpp-source.html

It should eventually be changed to use a worklist of functions instead of
iterating, but it is so fast that noone has bothered yet.

For example, on povray (+libpng +zlib) it IPCP's 23 args in 0.0048s at
compile-time and 50 more args in 0.0055s at link-time.

On 176.gcc, it IPCP's 13 args in 0.0055s at compile time and IPCP's 61
args in 0.0147s.

These are wall times to run a debug build of the optimization on a 3GHz
machine.  We run IPCP both at compile and link time because its fast and
because static functions and code in anonymous namespaces are suprisingly
common.

As always, if you want to play with this (or any other LLVM optimization)
you can do so on the demo page: http://llvm.cs.uiuc.edu/demo/

-Chris

-- 
http://llvm.cs.uiuc.edu/
http://www.nondot.org/~sabre/Projects/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]