summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/GlobalOpt
Commit message (Collapse)AuthorAgeFilesLines
...
* Convert the uses of '|&' to use '2>&1 |' instead, which works on oldChandler Carruth2012-07-021-1/+1
| | | | | | | | | | versions of Bash. In addition, I can back out the change to the lit built-in shell test runner to support this. This should fix the majority of fallout on Darwin, but I suspect there will be a few straggling issues. llvm-svn: 159544
* Convert all tests using TCL-style quoting to use shell-style quoting.Chandler Carruth2012-07-0211-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | This was done through the aid of a terrible Perl creation. I will not paste any of the horrors here. Suffice to say, it require multiple staged rounds of replacements, state carried between, and a few nested-construct-parsing hacks that I'm not proud of. It happens, by luck, to be able to deal with all the TCL-quoting patterns in evidence in the LLVM test suite. If anyone is maintaining large out-of-tree test trees, feel free to poke me and I'll send you the steps I used to convert things, as well as answer any painful questions etc. IRC works best for this type of thing I find. Once converted, switch the LLVM lit config to use ShTests the same as Clang. In addition to being able to delete large amounts of Python code from 'lit', this will also simplify the entire test suite and some of lit's architecture. Finally, the test suite runs 33% faster on Linux now. ;] For my 16-hardware-thread (2x 4-core xeon e5520): 36s -> 24s llvm-svn: 159525
* Revert r159136 due to PR13124.Matt Beaumont-Gay2012-06-271-14/+0
| | | | | | | | | | | Original commit message: If a constant or a function has linkonce_odr linkage and unnamed_addr, mark it hidden. Being linkonce_odr guarantees that it is available in every dso that needs it. Being a constant/function with unnamed_addr guarantees that the copies don't have to be merged. llvm-svn: 159272
* If a constant or a function has linkonce_odr linkage and unnamed_addr, mark itRafael Espindola2012-06-251-0/+14
| | | | | | | | hidden. Being linkonce_odr guarantees that it is available in every dso that needs it. Being a constant/function with unnamed_addr guarantees that the copies don't have to be merged. llvm-svn: 159136
* Some optimizations done by globalopt are safe only for internal linkage, notRafael Espindola2012-06-151-0/+12
| | | | | | | | linkonce linkage. For example, it is not valid to add unnamed_addr. This also fixes a crash in g++.dg/opt/static5.C. llvm-svn: 158528
* Implement the isSafeToDiscardIfUnused predicate and use it in globalopt andRafael Espindola2012-06-141-4/+20
| | | | | | | globaldce. Globaldce was already removing linkonce globals, but globalopt was not. llvm-svn: 158476
* Teach Function::hasAddressTaken that BlockAddress doesn't really takeJay Foad2012-05-121-0/+16
| | | | | | the address of a function. llvm-svn: 156703
* Fix a crash on valid (if UB) bitcode that is produced for some globalChandler Carruth2012-04-241-0/+5
| | | | | | | | | | | | | | | | | | | | | constants in C++11 mode. I have no idea why it required such particular circumstances to get here, the code seems clearly to rely upon unchecked assumptions. Specifically, when we decide to form an index into a struct type, we may have gone through (at least one) zero-length array indexing round, which would have left the offset un-adjusted, and thus not necessarily valid for use when indexing the struct type. This is just an canonicalization step, so the correct thing is to refuse to canonicalize nonsensical GEPs of this form. Implemented, and test case added. Fixes PR12642. Pair debugged and coded with Richard Smith. =] I credit him with most of the debugging, and preventing me from writing the wrong code. llvm-svn: 155466
* GlobalOpt: If we have an inbounds GEP from a ConstantAggregateZero global ↵Benjamin Kramer2012-03-281-0/+11
| | | | | | that we just determined to be constant, replace all loads from it with a zero value. llvm-svn: 153576
* Teach globalopt how to evaluate an invoke with a non-void return type.Dan Gohman2012-03-131-0/+27
| | | | llvm-svn: 152634
* Use the target-aware constant folder on expressions to improve the chanceNick Lewycky2012-02-211-0/+43
| | | | | | | | | | | | | they'll be simple enough to simulate, and to reduce the chance we'll encounter equal but different simple pointer constants. This removes the symptoms from PR11352 but is not a full fix. A proper fix would either require a guarantee that two constant objects we simulate are folded when equal, or a different way of handling equal pointers (ie., trying a constantexpr icmp on them to see whether we know they're equal or non-equal or unsure). llvm-svn: 151093
* Check for the correct size in the invariant marker.Nick Lewycky2012-02-201-4/+30
| | | | llvm-svn: 151003
* Remove question.Nick Lewycky2012-02-171-1/+0
| | | | llvm-svn: 150809
* Add support for invariant.start inside the static constructor evaluator. This isNick Lewycky2012-02-171-0/+34
| | | | | | | | | useful to represent a variable that is const in the source but can't be constant in the IR because of a non-trivial constructor. If globalopt evaluates the constructor, and there was an invariant.start with no matching invariant.end possible, it will mark the global constant afterwards. llvm-svn: 150794
* Replace all instances of dg.exp file with lit.local.cfg, since all tests are ↵Eli Bendersky2012-02-162-3/+1
| | | | | | | | run with LIT now and now Dejagnu. dg.exp is no longer needed. Patch reviewed by Daniel Dunbar. It will be followed by additional cleanup patches. llvm-svn: 150664
* GlobalOpt: Be more aggressive about elminating side-effect free static dtors.Benjamin Kramer2012-02-091-2/+4
| | | | | | | | | GlobalOpt runs early in the pipeline (before inlining) and complex class hierarchies often introduce bitcasts or GEPs which weren't optimized away. Teach it to ignore side-effect free instructions instead of depending on other passes to remove them. llvm-svn: 150174
* Teach GlobalOpt to handle atomic accesses to globals.Nick Lewycky2012-02-051-0/+10
| | | | | | | | | | | | | | | | | | | * Most of the transforms come through intact by having each transformed load or store copy the ordering and synchronization scope of the original. * The transform that turns a global only accessed in main() into an alloca (since main is non-recursive) with a store of the initial value uses an unordered store, since it's guaranteed to be the first thing to happen in main. (Threads may have started before main (!) but they can't have the address of a function local before the point in the entry block we insert our code.) * The heap-SRoA transforms are disabled in the face of atomic operations. This can probably be improved; it seems odd to have atomic accesses to an alloca that doesn't have its address taken. AnalyzeGlobal keeps track of the strongest ordering found in any use of the global. This is more information than we need right now, but it's cheap to compute and likely to be useful. llvm-svn: 149847
* PR11705, part 2: globalopt shouldn't put inttoptr/ptrtoint operations into ↵Eli Friedman2012-01-051-4/+15
| | | | | | global initializers if there's an implied extension or truncation. llvm-svn: 147625
* remove autoupgrade support for old forms of llvm.prefetch and the oldChris Lattner2011-11-271-57/+0
| | | | | | | trampoline forms. Both of these were correct in LLVM 3.0, and we don't need to support LLVM 2.9 and earlier in mainline. llvm-svn: 145174
* Upgrade syntax of tests using volatile instructions to use 'load volatile' ↵Chris Lattner2011-11-271-1/+1
| | | | | | instead of 'volatile load', which is archaic. llvm-svn: 145171
* Refactor code from inlining and globalopt that checks whether a function ↵Eli Friedman2011-10-201-0/+27
| | | | | | definition is unused, and enhance it so it can tell that functions which are only used by a blockaddress are in fact dead. This probably doesn't happen much on most code, but the Linux kernel's _THIS_IP_ can trigger this issue with blockaddress. (GlobalDCE can also handle the given tescase, but we only run that at -O3.) Found while looking at PR11180. llvm-svn: 142572
* Move "atomic" and "volatile" designations on instructions after the opcodeEli Friedman2011-08-121-1/+1
| | | | | | | | | | of the instruction. Note that this change affects the existing non-atomic load and store instructions; the parser now accepts both forms, and the change is noted in the release notes. llvm-svn: 137527
* Land the long talked about "type system rewrite" patch. ThisChris Lattner2011-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | patch brings numerous advantages to LLVM. One way to look at it is through diffstat: 109 files changed, 3005 insertions(+), 5906 deletions(-) Removing almost 3K lines of code is a good thing. Other advantages include: 1. Value::getType() is a simple load that can be CSE'd, not a mutating union-find operation. 2. Types a uniqued and never move once created, defining away PATypeHolder. 3. Structs can be "named" now, and their name is part of the identity that uniques them. This means that the compiler doesn't merge them structurally which makes the IR much less confusing. 4. Now that there is no way to get a cycle in a type graph without a named struct type, "upreferences" go away. 5. Type refinement is completely gone, which should make LTO much MUCH faster in some common cases with C++ code. 6. Types are now generally immutable, so we can use "Type *" instead "const Type *" everywhere. Downsides of this patch are that it removes some functions from the C API, so people using those will have to upgrade to (not yet added) new API. "LLVM 3.0" is the right time to do this. There are still some cleanups pending after this, this patch is large enough as-is. llvm-svn: 134829
* rip out a ton of intrinsic modernization logic from AutoUpgrade.cpp, which isChris Lattner2011-06-182-18/+13
| | | | | | | | | for pre-2.9 bitcode files. We keep x86 unaligned loads, movnt, crc32, and the target indep prefetch change. As usual, updating the testsuite is a PITA. llvm-svn: 133337
* manually upgrade a bunch of tests to modern syntax, and remove some thatChris Lattner2011-06-173-3/+10
| | | | | | are either unreduced or only test old syntax. llvm-svn: 133228
* Add testcase for r132290, to check for the crasher caught by the buildbotsNick Lewycky2011-05-291-2/+12
| | | | | | doing llvm-gcc selfhost (or cross). llvm-svn: 132292
* Obey the isVolatile bit on memory intrinsics when analyzing uses of a globalNick Lewycky2011-05-291-0/+19
| | | | | | | | | variable. Noticed by inspection. Simulate memset in EvaluateFunction where the target of the memset and the value we're setting are both the null value. Fixes PR10047! llvm-svn: 132288
* fix PR9856, an incorrectly conservative assertion: a global can beChris Lattner2011-05-221-0/+14
| | | | | | "stored once" even if its address is compared. llvm-svn: 131849
* Add back a couple checks removed by r129128; the fact that an intitializerEli Friedman2011-04-091-0/+5
| | | | | | | is an array of structures doesn't imply it's a ConstantArray of ConstantStruct. llvm-svn: 129207
* Add an optimization to GlobalOpt that eliminates calls to __cxa_atexit, if ↵Anders Carlsson2011-03-201-0/+31
| | | | | | the function passed is empty. llvm-svn: 127970
* Add unnamed_addr when we can show that address of a global is not used.Rafael Espindola2011-01-196-7/+61
| | | | llvm-svn: 123834
* Reduce and merge testcases.Owen Anderson2011-01-162-60/+16
| | | | llvm-svn: 123579
* Improve the safety of my globalopt enhancement by ensuring that the bitcastOwen Anderson2011-01-161-0/+59
| | | | | | of the stored value to the new store type is always. Also, add a testcase. llvm-svn: 123563
* fix a globalopt crash on two Adobe-C++ testcases that the recentChris Lattner2011-01-011-0/+9
| | | | | | loop idiom pass exposed. llvm-svn: 122674
* reapply r121100 with a tweak to constant fold ConstExprs with TargetDataChris Lattner2010-12-071-0/+23
| | | | | | | | (if available) as we go so that we get simple constantexprs not insane ones. This fixes the failure of clang/test/CodeGenCXX/virtual-base-ctor.cpp that the previous iteration of this patch had. llvm-svn: 121111
* Temporarily revert r121100 as it's causing clang to failEric Christopher2010-12-071-23/+0
| | | | | | CodeGenCXX/virtual-base-ctor.cpp. llvm-svn: 121102
* fix PR8710 - teach global opt that some constantexprs are too complex toChris Lattner2010-12-071-0/+23
| | | | | | put in a global variable's initializer. llvm-svn: 121100
* GlobalOpt: EvaluateFunction() must not evaluate stores to weak_odr globals.Mikhail Glushenkov2010-10-191-0/+16
| | | | | | Fixes PR8389. llvm-svn: 116812
* Fix this test to avoid an "inexact" fold.Dan Gohman2010-09-171-1/+1
| | | | llvm-svn: 114202
* fix PR8063, a crash in globalopt in the malloc analysis code.Chris Lattner2010-09-051-0/+15
| | | | llvm-svn: 113109
* more test cleanupChris Lattner2010-09-021-1/+1
| | | | llvm-svn: 112892
* Use llvm.foo as the intrinsic, rather than llvm.dbg.value. Since theDuncan Sands2010-05-041-4/+3
| | | | | | | | values passed to llvm.dbg.value were not valid for the intrinsic, it might have caused trouble one day if the verifier ever started checking for valid debug info. llvm-svn: 103038
* Fix a variant of PR6112 found by thinking about it: when doingDuncan Sands2010-05-041-4/+12
| | | | | | | | | | RAUW of a global variable with a local variable in function F, if function local metadata M in function G was using the global then M would become function-local to both F and G, which is not allowed. See the testcase for an example. Fixed by detecting this situation and zapping the metadata operand when it occurs. llvm-svn: 103007
* fix this to work with objdir != srcdirChris Lattner2010-04-281-1/+1
| | | | llvm-svn: 102547
* fix PR6112 - When globalopt (or any other pass) does RAUW(@G, %G), Chris Lattner2010-04-281-0/+19
| | | | | | | metadata references in non-function-local MDNodes should drop to null. llvm-svn: 102519
* Trim tests and convert to FileCheck.Evan Cheng2010-04-142-48/+13
| | | | llvm-svn: 101277
* fix PR6760, a missing check in heap SRoA.Chris Lattner2010-04-101-1/+27
| | | | llvm-svn: 100936
* Revert the recent alignment changes. They're broken for -Os because,Dan Gohman2010-04-021-6/+0
| | | | | | | in particular, they end up aligning strings at 16-byte boundaries, and there's no way for GlobalOpt to check OptForSize. llvm-svn: 100172
* Make globalopt refine global variable alignment.Dan Gohman2010-04-021-0/+6
| | | | llvm-svn: 100160
* @llvm.dbg.stoppoint intrinsic is not used anymore.Devang Patel2010-03-011-98/+0
| | | | | | Delete dead testcase. llvm-svn: 97489
OpenPOWER on IntegriCloud