llvm-project/llvm/lib/Transforms
Chris Lattner 8d1da1abee My faith in programmers has been found to be totally misplaced. One would
assume that if they don't intend to write to a global variable, that they
would mark it as constant.  However, there are people that don't understand
that the compiler can do nice things for them if they give it the information
it needs.

This pass looks for blatently obvious globals that are only ever read from.
Though it uses a trivially simple "alias analysis" of sorts, it is still able
to do amazing things to important benchmarks.  253.perlbmk, for example,
contains several ***GIANT*** function pointer tables that are not marked
constant and should be.  Marking them constant allows the optimizer to turn
a whole bunch of indirect calls into direct calls.  Note that only a link-time
optimizer can do this transformation, but perlbmk does have several strings
and other minor globals that can be marked constant by this pass when run
from GCCAS.

176.gcc has a ton of strings and large tables that are marked constant, both
at compile time (38 of them) and at link time (48 more).  Other benchmarks
give similar results, though it seems like big ones have disproportionally
more than small ones.

This pass is extremely quick and does good things.  I'm going to enable it
in gccas & gccld.  Not bad for 50 SLOC.

llvm-svn: 11836
2004-02-25 21:34:36 +00:00
..
Hello Finegrainify namespacification 2004-01-09 06:12:26 +00:00
IPO My faith in programmers has been found to be totally misplaced. One would 2004-02-25 21:34:36 +00:00
Instrumentation Remove dependence on return type of ConstantStruct::get 2004-02-15 04:07:32 +00:00
Scalar Fix incorrect debug code 2004-02-25 15:15:04 +00:00
Utils If a block is made dead, make sure to promptly remove it. 2004-02-24 16:09:21 +00:00
ExprTypeConvert.cpp Start using the new and improve interface to FunctionType arguments 2004-02-09 04:14:01 +00:00
LevelRaise.cpp Adjust to the changed StructType interface. In particular, getElementTypes() is gone. 2004-02-09 04:37:31 +00:00
Makefile Added LLVM copyright notice to Makefiles. 2003-10-20 22:26:57 +00:00
TransformInternals.cpp Adjust to the changed StructType interface. In particular, getElementTypes() is gone. 2004-02-09 04:37:31 +00:00
TransformInternals.h Put all LLVM code into the llvm namespace, as per bug 109. 2003-11-11 22:41:34 +00:00