llvm-project/llvm/lib
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
..
Analysis Add a bunch more functions used by perlbmk 2004-02-25 17:43:20 +00:00
AsmParser It turns out that the two dimensional vectors were causing big slowdowns 2004-02-09 21:03:38 +00:00
Bytecode This debugging hook is no longer needed. 2004-02-09 17:20:52 +00:00
CodeGen Add an assertion 2004-02-25 19:37:44 +00:00
Debugger "fix" a nasty race condition 2004-01-14 21:18:03 +00:00
ExecutionEngine Great renaming part II: Sparc --> SparcV9 (also includes command-line options and Makefiles) 2004-02-25 19:08:12 +00:00
Support `cat' is usually in /bin, not /usr/bin, at least on our systems. 2004-02-21 21:51:41 +00:00
Target SparcV8 regs are really 32-bit, not 64! Thanks, Chris. 2004-02-25 21:03:02 +00:00
Transforms My faith in programmers has been found to be totally misplaced. One would 2004-02-25 21:34:36 +00:00
VMCore Make the verifier a little more explicit about this problem. 2004-02-24 22:06:07 +00:00
Makefile CBackend is no longer here 2004-02-13 23:29:37 +00:00