Commit Graph

5 Commits

Author SHA1 Message Date
Chris Lattner ec67df0ed1 Ignore instructions that are in trivially dead functions. This allows us
to constify 14 globals instead of 4 in a trivial C++ testcase.

llvm-svn: 15027
2004-07-20 03:58:07 +00:00
Chris Lattner d47504d9db Strip out and simplify some code. This also fixes the regression last
night compiling cfrac.  It did not realize that code like this:

int G; int *H = &G;

takes the address of G.

llvm-svn: 14973
2004-07-18 19:56:20 +00:00
Reid Spencer cb3fb5d4f5 bug 122:
- Replace ConstantPointerRef usage with GlobalValue usage

llvm-svn: 14953
2004-07-18 00:44:37 +00:00
Chris Lattner e82c217b2f setcond instructions don't have aliasing implications.
llvm-svn: 11919
2004-02-27 18:09:25 +00:00
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