summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/GlobalOpt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Add some ifdef'd out debug infoChris Lattner2006-09-301-3/+30
| | | | llvm-svn: 30676
* Eliminate ConstantBool::True and ConstantBool::False. Instead, provideChris Lattner2006-09-281-4/+5
| | | | | | ConstantBool::getTrue() and ConstantBool::getFalse(). llvm-svn: 30665
* Adding dllimport, dllexport and external weak linkage types.Anton Korobeynikov2006-09-141-2/+2
| | | | | | | | | DLL* linkages got full (I hope) codegeneration support in C & both x86 assembler backends. External weak linkage added for future use, we don't provide any codegeneration, etc. support for it. llvm-svn: 30374
* eliminate RegisterOpt. It does the same thing as RegisterPass.Chris Lattner2006-08-271-3/+4
| | | | llvm-svn: 29925
* Fix PR820 and Transforms/GlobalOpt/2006-07-07-InlineAsmCrash.llChris Lattner2006-07-071-0/+3
| | | | llvm-svn: 29071
* Make iostream #inclusion explicitChris Lattner2006-01-221-1/+2
| | | | llvm-svn: 25514
* Add support alignment of allocation instructions.Nate Begeman2005-11-051-1/+2
| | | | | | | | | Add support for specifying alignment and size of setjmp jmpbufs. No targets currently do anything with this information, nor is it presrved in the bytecode representation. That's coming up next. llvm-svn: 24196
* Stop using deprecated typesAlkis Evlogimenos2005-10-251-1/+2
| | | | llvm-svn: 23973
* Fix a regression in my previous patch, fixing GlobalOpt/2005-09-27-Crash.llChris Lattner2005-09-271-1/+1
| | | | | | and PR632. llvm-svn: 23484
* Add support for external calls that we know how to constant fold. This ↵Chris Lattner2005-09-271-11/+20
| | | | | | | | implements ctor-list-opt.ll:CTOR8 llvm-svn: 23465
* Fix a bug where we would evaluate stores into linkonce objects which could beChris Lattner2005-09-271-1/+6
| | | | | | potentially replaced at link-time. llvm-svn: 23463
* Implement support for static constructors with calls in them. This is usefulChris Lattner2005-09-271-23/+54
| | | | | | | | because gccas runs globalopt before inlining. This implements ctor-list-opt.ll:CTOR7 llvm-svn: 23462
* Refactor this code a bit, no functionality changes.Chris Lattner2005-09-271-22/+40
| | | | llvm-svn: 23460
* Remove some dead code. ctor evaluation subsumes empty ctor elimChris Lattner2005-09-261-12/+0
| | | | llvm-svn: 23453
* Add support for alloca, implementing ctor-list-opt.ll:CTOR6Chris Lattner2005-09-261-17/+48
| | | | llvm-svn: 23452
* Add a debug printout, fix a crash on kc++Chris Lattner2005-09-261-1/+6
| | | | llvm-svn: 23450
* Implement loads/stores through GEP's of globals. This implementsChris Lattner2005-09-261-6/+98
| | | | | | ctor-list-opt.ll:CTOR5. llvm-svn: 23449
* Replace TraverseGEPInitializer with ConstantFoldLoadThroughGEPConstantExprChris Lattner2005-09-261-17/+5
| | | | llvm-svn: 23447
* add a commentChris Lattner2005-09-261-0/+3
| | | | llvm-svn: 23442
* Add support for getelementptr, load, and correctly reject volatile stores.Chris Lattner2005-09-261-0/+29
| | | | llvm-svn: 23441
* Add support for br/brcond/switch and phiChris Lattner2005-09-261-3/+47
| | | | llvm-svn: 23439
* Add a simple interpreter to this code, allowing us to statically evaluateChris Lattner2005-09-261-4/+110
| | | | | | global ctors that are simple enough. This implements ctor-list-opt.ll:CTOR2. llvm-svn: 23437
* factor some code into a InstallGlobalCtors method, add comments. No ↵Chris Lattner2005-09-261-35/+52
| | | | | | functionality change. llvm-svn: 23435
* Make the global opt optimizer work on modules with a null terminator, byChris Lattner2005-09-261-8/+13
| | | | | | accepting the null even with a non-65535 init prio llvm-svn: 23434
* Factor this code out into a few methods.Chris Lattner2005-09-261-33/+190
| | | | | | | | | | | | | Implement the start of global ctor optimization. It is currently smart enough to remove the global ctor for cases like this: struct foo { foo() {} } x; ... saving a bit of startup time for the program. llvm-svn: 23433
* Do not promote globals only used by main to locals if there are constantexprsChris Lattner2005-06-151-3/+11
| | | | | | or other uses hanging off of them. llvm-svn: 22219
* Convert non-address taken functions with C calling conventions to fastcc.Chris Lattner2005-05-081-1/+41
| | | | llvm-svn: 21791
* Remove trailing whitespaceMisha Brukman2005-04-211-23/+23
| | | | llvm-svn: 21427
* This mega patch converts us from using Function::a{iterator|begin|end} toChris Lattner2005-03-151-4/+4
| | | | | | | | using Function::arg_{iterator|begin|end}. Likewise Module::g* -> Module::global_*. This patch is contributed by Gabor Greif, thanks! llvm-svn: 20597
* Teach globalopt how memset/cpy/move affect memory, to allow better optimization.Chris Lattner2005-02-271-25/+40
| | | | llvm-svn: 20352
* make this more efficient. Scan up to 16 nodes, not the whole list.Chris Lattner2005-02-231-1/+1
| | | | llvm-svn: 20289
* Localize globals if they are only used in main(). This replaces theAlkis Evlogimenos2005-02-101-0/+40
| | | | | | | global with an alloca, which eventually gets promoted into a register. This enables a lot of other optimizations later on. llvm-svn: 20109
* Adjust to changes in APIsChris Lattner2005-02-011-13/+7
| | | | llvm-svn: 19958
* Fix VS warnings.Chris Lattner2005-01-081-3/+4
| | | | llvm-svn: 19382
* Properly implement copying of a global, fixing the 255.vortex & povrayChris Lattner2004-12-121-2/+25
| | | | | | failures from last night. llvm-svn: 18832
* Though the previous xform applies to literally dozens (hundreds?) of variablesChris Lattner2004-12-121-1/+2
| | | | | | | | | | | | | | | | | | | | in SPEC, the subsequent optimziations that we are after don't play with with FP values, so disable this xform for them. Really we just don't want stuff like: double G; (always 0 or 412312.312) = G; turning into: bool G_b; = G_b ? 412312.312 : 0; We'd rather just do the load. -Chris llvm-svn: 18819
* If a variable can only hold two values, and is not already a bool, shrink itChris Lattner2004-12-121-22/+78
| | | | | | | | | | down to actually BE a bool. This allows simple value range propagation stuff work harder, deleting comparisons in bzip2 in some hot loops. This implements GlobalOpt/integer-bool.ll, which is the essence of the loop condition distilled into a testcase. llvm-svn: 18817
* Implement a FIXME by checking to make sure that a malloc is not being usedChris Lattner2004-12-021-3/+25
| | | | | | | | | in scary and unknown ways before we promote it. This fixes the miscompilation of 188.ammp that has been plauging us since a globalopt patch went in. Thanks a ton to Tanya for helping me diagnose the problem! llvm-svn: 18418
* Fix a minor bug where we set a var to initialized on malloc, not on store.Chris Lattner2004-12-021-10/+17
| | | | | | This doesn't fix anything that I'm aware of, just noticed it by inspection llvm-svn: 18417
* If a global is just loaded and restored, realize that it is not changingChris Lattner2004-11-141-3/+9
| | | | | | | | | | | | | | | | | | | value. This allows us to turn more globals into constants and eliminate them. This patch implements GlobalOpt/load-store-global.llx. Note that this patch speeds up 255.vortex from: Output/255.vortex.out-cbe.time:program 7.640000 Output/255.vortex.out-llc.time:program 9.810000 to: Output/255.vortex.out-cbe.time:program 7.250000 Output/255.vortex.out-llc.time:program 9.490000 Which isn't bad at all! llvm-svn: 17746
* *** empty log message ***Chris Lattner2004-10-221-4/+47
| | | | llvm-svn: 17161
* Add support for the undef value. Implement a new optimization based on globalsChris Lattner2004-10-161-22/+56
| | | | | | | that are initialized with undef. When promoting malloc to a global, start out initialized to undef llvm-svn: 17042
* Fix a bug John tracked down in libstdc++ where we were incorrectly deletingChris Lattner2004-10-141-1/+2
| | | | | | weak functions. Thanks for finding this John! llvm-svn: 16997
* This patch implements two things (sorry).Chris Lattner2004-10-111-25/+182
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, it allows SRA of globals that have embedded arrays, implementing GlobalOpt/globalsra-partial.llx. This comes up infrequently, but does allow, for example, deleting several stores to dead parts of globals in dhrystone. Second, this implements GlobalOpt/malloc-promote-*.llx, which is the following nifty transformation: Basically if a global pointer is initialized with malloc, and we can tell that the program won't notice, we transform this: struct foo *FooPtr; ... FooPtr = malloc(sizeof(struct foo)); ... FooPtr->A FooPtr->B Into: struct foo FooPtrBody; ... FooPtrBody.A FooPtrBody.B This comes up occasionally, for example, the 'disp' global in 183.equake (where the xform speeds the CBE version of the program up from 56.16s to 52.40s (7%) on apoc), and the 'desired_accept', 'fixLRBT', 'macroArray', & 'key_queue' globals in 300.twolf (speeding it up from 22.29s to 21.55s (3.4%)). The nice thing about this xform is that it exposes the resulting global to global variable optimization and makes alias analysis easier in addition to eliminating a few loads. llvm-svn: 16916
* Just because we cannot completely eliminate all uses of a global, we canChris Lattner2004-10-101-27/+124
| | | | | | | | | | | | | | | | still optimize away all of the indirect calls and loads, etc from it. This turns code like this: if (G != 0) G(); into if (G != 0) ActualCallee(); This triggers a couple of times in gcc and libstdc++. llvm-svn: 16901
* Fix 2004-10-10-CastStoreOnce.llx, by adjusting types back if we strip off a castChris Lattner2004-10-101-20/+23
| | | | llvm-svn: 16878
* Implement GlobalOpt/deadglobal-2.llx, deletion of globals that are onlyChris Lattner2004-10-101-0/+11
| | | | | | | stored to, but are stored at variable indexes. This occurs at least in 176.gcc, but probably others, and we should handle it for completeness. llvm-svn: 16876
* Avoid calling use_size() which could (in theory) be expensive if the globalChris Lattner2004-10-101-12/+18
| | | | | | | | | has a large number of users. Instead, just keep track of whether we're making changes as we do so. This patch has no functionlity changes. llvm-svn: 16874
* Eliminate global pointers that are only stored a single value and null ifChris Lattner2004-10-091-0/+103
| | | | | | | | | | | | | | | | | | | | | we know that all uses of the global will trap if the pointer contained is null. In this case, we forward substitute the stored value to any uses. This has the effect of devirtualizing trivial globals in trivial cases. For example, 164.gzip contains this: gzip.h:extern int (*read_buf) OF((char *buf, unsigned size)); bits.c: read_buf = file_read; deflate.c: lookahead = read_buf((char*)window, deflate.c: n = read_buf((char*)window+strstart+lookahead, more); Since read_buf has to point to file_read at every use, we just replace the calls through read_buf with a direct call to file_read. This occurs in several benchmarks, including 176.gcc and 164.gzip. Direct calls are good and stuff. llvm-svn: 16871
* Fix infinite loop due to iterationChris Lattner2004-10-091-1/+7
| | | | llvm-svn: 16864
OpenPOWER on IntegriCloud