summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/GlobalConstifier.cpp
Commit message (Collapse)AuthorAgeFilesLines
* * Rename pass to globalopt, since we do more than just constifyChris Lattner2004-10-071-147/+0
| | | | | | | | | | | | | | | | * Instead of handling dead functions specially, just nuke them. * Be more aggressive about cleaning up after constification, in particular, handle getelementptr instructions and constantexprs. * Be a little bit more structured about how we process globals. *** Delete globals that are only stored to, and never read. These are clearly not useful, so they should go. This implements deadglobal.llx This last one triggers quite a few times. In particular, 2208 in the external tests, 1865 of which are in 252.eon. This shrinks eon from 1995094 to 1732341 bytes of bytecode. llvm-svn: 16802
* Implement GlobalConstifier/trivialstore.llx, and also do someChris Lattner2004-10-061-3/+52
| | | | | | | | | | | | | | | | | | | | | | | | simplifications of the resultant program to avoid making later passes do it all. This allows us to constify globals that just have the same constant that they are initialized stored into them. Suprisingly this comes up ALL of the freaking time, dozens of times in SPEC, 30 times in vortex alone. For example, on 256.bzip2, it allows us to constify these two globals: %smallMode = internal global ubyte 0 ; <ubyte*> [#uses=8] %verbosity = internal global int 0 ; <int*> [#uses=49] Which (with later optimizations) results in the bytecode file shrinking from 82286 to 69686 bytes! Lets hear it for IPO :) For the record, it's nuking lots of "if (verbosity > 2) { do lots of stuff }" code. llvm-svn: 16793
* 'Pass' should now not be derived from by clients. Instead, they should deriveChris Lattner2004-09-201-4/+4
| | | | | | | from ModulePass. Instead of implementing Pass::run, then should implement ModulePass::runOnModule. llvm-svn: 16436
* Changes For Bug 352Reid Spencer2004-09-011-2/+2
| | | | | | | | Move include/Config and include/Support into include/llvm/Config, include/llvm/ADT and include/llvm/Support. From here on out, all LLVM public header files must be under include/llvm/. llvm-svn: 16137
* Implement test/Regression/Transforms/GlobalConstifier/phi-select.llxChris Lattner2004-08-141-6/+16
| | | | | | This allows more globals to be marked constant, particularly global arrays. llvm-svn: 15735
* Ignore instructions that are in trivially dead functions. This allows usChris Lattner2004-07-201-4/+17
| | | | | | to constify 14 globals instead of 4 in a trivial C++ testcase. llvm-svn: 15027
* Strip out and simplify some code. This also fixes the regression lastChris Lattner2004-07-181-9/+2
| | | | | | | | | | night compiling cfrac. It did not realize that code like this: int G; int *H = &G; takes the address of G. llvm-svn: 14973
* bug 122:Reid Spencer2004-07-181-2/+2
| | | | | | - Replace ConstantPointerRef usage with GlobalValue usage llvm-svn: 14953
* setcond instructions don't have aliasing implications.Chris Lattner2004-02-271-2/+2
| | | | llvm-svn: 11919
* My faith in programmers has been found to be totally misplaced. One wouldChris Lattner2004-02-251-0/+82
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
OpenPOWER on IntegriCloud