summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* A non-escaping malloc in the entry block is not unlike an alloca. Do dead-storeNick Lewycky2011-10-221-2/+25
| | | | | | elimination on them too. llvm-svn: 142735
* Enhance the memdep interface so that users can tell the difference between a ↵Eli Friedman2011-10-131-3/+3
| | | | | | | | dependency which cannot be calculated and a path reaching the entry point of the function. This patch introduces isNonFuncLocal, which replaces isUnknown in some cases. Patch by Xiaoyi Guo. llvm-svn: 141896
* Add comment to clarify the behavior of a helper in DSE.Eli Friedman2011-09-131-0/+2
| | | | llvm-svn: 139571
* Try again at r138809 (make DSE more aggressive in removing dead stores at ↵Owen Anderson2011-09-061-79/+80
| | | | | | the end of a function), now with less deleting stores before memcpy's. llvm-svn: 139150
* Speculatively revert r138809 in an attempt to fix DragonEgg.Owen Anderson2011-08-301-2/+1
| | | | llvm-svn: 138829
* When walking backwards to eliminate final stores to allocas at the end of a ↵Owen Anderson2011-08-301-1/+2
| | | | | | function, encountering an unrelated store should not cause us to give up like encountering a load does. llvm-svn: 138809
* Atomic load/store handling for the passes using memdep (GVN, DSE, memcpyopt).Eli Friedman2011-08-171-3/+5
| | | | llvm-svn: 137888
* Misc mid-level changes for new 'fence' instruction.Eli Friedman2011-07-271-3/+6
| | | | llvm-svn: 136205
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-1/+1
| | | | llvm-svn: 135375
* Add "unknown" results for memdep, which mean "I don't know whether a ↵Eli Friedman2011-06-151-13/+12
| | | | | | dependence for the given instruction exists in the given block". This cleans up all the existing hacks in memdep which represent this concept by returning clobber with various unrelated instructions. llvm-svn: 133031
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-151-1/+1
| | | | | | Luis Felipe Strano Moraes! llvm-svn: 129558
* * The DSE code that tested for overlapping needed to take into account the factBill Wendling2011-03-301-1/+3
| | | | | | | | | | | | that one of the numbers is signed while the other is unsigned. This could lead to a wrong result when the signed was promoted to an unsigned int. * Add the data layout line to the testcase so that it will test the appropriate thing. Patch by David Terei! llvm-svn: 128577
* DSE: Remove an early exit optimization that depended on the ordering of a ↵Benjamin Kramer2011-03-291-13/+0
| | | | | | | | SmallPtrSet. Fixes PR9569 and will hopefully make selfhost on ASLR-enabled systems more deterministic. llvm-svn: 128482
* Simplification noticed by Frits.Bill Wendling2011-03-261-3/+2
| | | | llvm-svn: 128333
* Rework the logic that determines if a store completely overlaps an ealier store.Bill Wendling2011-03-261-15/+23
| | | | | | | | | | | There are two ways that a later store can comletely overlap a previous store: 1. They both start at the same offset, but the earlier store's size is <= the later's size, or 2. The earlier store's offset is > the later's offset, but it's offset + size doesn't extend past the later's offset + size. llvm-svn: 128332
* PR9561: A store with a negative offset (via GEP) could erroniously say that itBill Wendling2011-03-261-0/+2
| | | | | | | completely overlaps a previous store, thus mistakenly deleting that store. Check for this condition. llvm-svn: 128319
* Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman2011-01-241-1/+2
| | | | | | | | | | | with BasicAA's DecomposeGEPExpression, which recently began using a TargetData. This fixes PR8968, though the testcase is awkward to reduce. Also, update several off GetUnderlyingObject's users which happen to have a TargetData handy to pass it in. llvm-svn: 124134
* Remove code for updating dominance frontiers and some outdated references toCameron Zwarich2011-01-181-3/+0
| | | | | | dominance and post-dominance frontiers. llvm-svn: 123725
* Move Value::getUnderlyingObject to be a standaloneDan Gohman2010-12-151-4/+4
| | | | | | | function so that it can live in Analysis instead of VMCore. llvm-svn: 121885
* Use a stronger predicate here, pointed out by DuncanChris Lattner2010-12-061-1/+1
| | | | llvm-svn: 121040
* add some DEBUG statements.Chris Lattner2010-12-061-3/+14
| | | | llvm-svn: 121038
* Fix PR8728, a miscompilation I recently introduced. When optimizingChris Lattner2010-12-061-5/+62
| | | | | | | | | | | | | | | | | | | | | memcpy's like: memcpy(A, B) memcpy(A, C) we cannot delete the first memcpy as dead if A and C might be aliases. If so, we actually get: memcpy(A, B) memcpy(A, A) which is not correct to transform into: memcpy(A, A) This patch was heavily influenced by Jakub Staszak's patch in PR8728, thanks Jakub! llvm-svn: 120974
* Enhance DSE to handle the variable index case in PR8657.Chris Lattner2010-11-301-2/+31
| | | | llvm-svn: 120498
* teach DSE to use GetPointerBaseWithConstantOffset to analyzeChris Lattner2010-11-301-16/+49
| | | | | | | | may-aliasing stores that partially overlap with different base pointers. This implements PR6043 and the non-variable part of PR8657 llvm-svn: 120485
* Make DeleteDeadInstruction be a static function, move some code around.Chris Lattner2010-11-301-59/+64
| | | | llvm-svn: 120471
* switch RemoveAccessedObjects to use AliasAnalysis::Location to simplifyChris Lattner2010-11-301-17/+13
| | | | | | | the code. We now get accurate sizes on Loads, though it surely doesn't matter in practice. llvm-svn: 120469
* two improvements to RemoveAccessedObjects:Chris Lattner2010-11-301-28/+7
| | | | | | | | | | | | | 1. if the underlying pointer passed in can be resolved to any argument or alloca, then we don't need to scan. Previously we would only avoid the scan if the alloca or byval was actually considered dead. 2. The dead store processing code is itself completely dead and didn't handle volatile stores right anyway, so delete it. This allows simplifying the interface to RemoveAccessedObjects. llvm-svn: 120467
* remove the "undead" terminology, which is nonstandard and never Chris Lattner2010-11-301-40/+47
| | | | | | | | made sense to me. We now have a set of dead stack objects, and they become live when loaded. Fix a theoretical problem where we'd pass in the wrong pointer to the alias query. llvm-svn: 120465
* move call handling in handleEndBlock up a bit, and simplify it.Chris Lattner2010-11-301-37/+40
| | | | | | | | If the call might read all the allocas, stop scanning early. Convert a vector to smallvector, shrink SmallPtrSet to 16 instead of 64 to avoid crazy linear scans. llvm-svn: 120463
* various cleanups and code simplificationChris Lattner2010-11-301-87/+63
| | | | llvm-svn: 120454
* make getPointerSize a static function. Add ivars to DSE forChris Lattner2010-11-301-46/+42
| | | | | | AA and MD pass info instead of using getAnalysis<> all over. llvm-svn: 120453
* reduce indentation, clean up TD use a bit.Chris Lattner2010-11-301-28/+31
| | | | llvm-svn: 120452
* enhance isRemovable to refuse to delete volatile mem transfersChris Lattner2010-11-301-4/+19
| | | | | | | now that DSE hacks on them. This fixes a regression I introduced, by generalizing DSE to hack on transfers. llvm-svn: 120445
* Rewrite the main DSE loop to be written in terms of reasoningChris Lattner2010-11-301-77/+106
| | | | | | | | | | | | | | about pairs of AA::Location's instead of looking for MemDep's "Def" predicate. This is more powerful and general, handling memset/memcpy/store all uniformly, and implementing PR8701 and probably obsoleting parts of memcpyoptimizer. This also fixes an obscure bug with init.trampoline and i8 stores, but I'm not surprised it hasn't been hit yet. Enhancing init.trampoline to carry the size that it stores would allow DSE to be much more aggressive about optimizing them. llvm-svn: 120406
* rename a function and reduce some indentation, no functionality change.Chris Lattner2010-11-301-19/+21
| | | | llvm-svn: 120391
* rename doesClobberMemory -> hasMemoryWrite to be more specific, andChris Lattner2010-11-301-11/+11
| | | | | | remove an actively-wrong comment. llvm-svn: 120378
* clean up handling of 'free', detangling it from everything else.Chris Lattner2010-11-301-22/+22
| | | | | | | It can be seriously improved, but at least now it isn't intertwined with the other logic. llvm-svn: 120377
* Teach basicaa that memset's modref set is at worst "mod" and neverChris Lattner2010-11-301-7/+12
| | | | | | | | | | contains "ref". Enhance DSE to use a modref query instead of a store-specific hack to generalize the "ignore may-alias stores" optimization to handle memset and memcpy. llvm-svn: 120368
* my previous patch would cause us to start deleting some volatileChris Lattner2010-11-301-1/+1
| | | | | | stores, fix and add a testcase. llvm-svn: 120363
* two changes to DSE that shouldn't affect anything:Chris Lattner2010-11-301-58/+28
| | | | | | | | | | | | | | 1. Don't bother trying to optimize: lifetime.end(ptr) store(ptr) as it is undefined, and therefore shouldn't exist. 2. Move the 'storing a loaded pointer' xform up, simplifying the may-aliased store code. llvm-svn: 120359
* fix PR8677, patch by Jakub Staszak!Chris Lattner2010-11-291-2/+4
| | | | llvm-svn: 120325
* implement PR8576, deleting dead stores with intervening may-alias stores.Chris Lattner2010-11-211-3/+22
| | | | llvm-svn: 119927
* Enhance DSE to handle the case where a free call makes more thanDan Gohman2010-11-121-12/+24
| | | | | | | one store dead. This is especially noticeable in SingleSource/Benchmarks/Shootout/objinst. llvm-svn: 118875
* Reapply r116831 and r116839, converting AliasAnalysis to useDan Gohman2010-10-191-13/+15
| | | | | | uint64_t, plus fixes for places I missed before. llvm-svn: 116875
* Revert r116831 and r116839, which are breaking selfhost builds.Dan Gohman2010-10-191-3/+3
| | | | llvm-svn: 116858
* Oops, check in all the files for converting AliasAnalysis toDan Gohman2010-10-191-3/+3
| | | | | | use uint64_t. llvm-svn: 116839
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-1/+3
| | | | | | | | | | | | | | | | | exposes an initializeMyPassFunction(), which must be called in the pass's constructor. This function uses static dependency declarations to recursively initialize the pass's dependencies. Clients that only create passes through the createFooPass() APIs will require no changes. Clients that want to use the CommandLine options for passes will need to manually call the appropriate initialization functions in PassInitialization.h before parsing commandline arguments. I have tested this with all standard configurations of clang and llvm-gcc on Darwin. It is possible that there are problems with the static dependencies that will only be visible with non-standard options. If you encounter any crash in pass registration/creation, please send the testcase to me directly. llvm-svn: 116820
* Consistently use AliasAnalysis::UnknownSize instead of hardcoding ~0u.Dan Gohman2010-10-191-4/+4
| | | | llvm-svn: 116815
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-121-1/+5
| | | | | | | | | perform initialization without static constructors AND without explicit initialization by the client. For the moment, passes are required to initialize both their (potential) dependencies and any passes they preserve. I hope to be able to relax the latter requirement in the future. llvm-svn: 116334
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | llvm-svn: 115996
OpenPOWER on IntegriCloud