summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Reverted r152620 - DSE: Shorten memset when a later store overwrites the ↵Pete Cooper2012-02-281-66/+2
| | | | | | start of it. There were all sorts of buildbot issues llvm-svn: 151621
* DSE: Shorten memset when a later store overwrites the start of itPete Cooper2012-02-281-2/+66
| | | | llvm-svn: 151620
* Convert assert(0) to llvm_unreachableCraig Topper2012-02-071-2/+2
| | | | llvm-svn: 149967
* Fix infinite loop in DSE when deleting a free in a reachable loop that's alsoNick Lewycky2011-12-081-1/+1
| | | | | | trivially infinite. llvm-svn: 146197
* Fixed deadstoreelimination bug where negative indices were incorrectly ↵Pete Cooper2011-12-031-1/+1
| | | | | | | | | | causing the optimisation to occur Turns out long long + unsigned long long is unsigned. Doh! Fixes http://llvm.org/bugs/show_bug.cgi?id=11455 llvm-svn: 145731
* Merge isObjectPointerWithTrustworthySize with getPointerSize. Use it whenNick Lewycky2011-11-161-30/+20
| | | | | | looking at the size of the pointee. Fixes PR11390! llvm-svn: 144773
* Fixed bug in DeadStoreElimination commit r144239Pete Cooper2011-11-101-1/+1
| | | | | | | | Size of data being pointed to wasn't always being checked so some small writes were killing big writes Fixes <rdar://problem/10426753> llvm-svn: 144312
* DeadStoreElimination can now trim the size of a store if the end of the ↵Pete Cooper2011-11-091-33/+110
| | | | | | | | | | | store is dead. Currently checks alignment and killing stores on a power of 2 boundary as this is likely to trim the size of the earlier store without breaking large vector stores into scalar ones. Fixes <rdar://problem/10140300> llvm-svn: 144239
* Do simple cross-block DSE when we encounter a free statement. Fixes PR11240.Nick Lewycky2011-11-051-25/+56
| | | | llvm-svn: 143808
* Speculatively revert "DeadStoreElimination can now trim the size of a store ifDaniel Dunbar2011-11-041-109/+33
| | | | | | the end of it is dead.", which appears to break bootstrapping LLVM. llvm-svn: 143668
* DeadStoreElimination can now trim the size of a store if the end of it is dead.Pete Cooper2011-11-031-33/+109
| | | | | | | | | | Only currently done if the later store is writing to a power of 2 address or has the same alignment as the earlier store as then its likely to not break up large stores into smaller ones Fixes <rdar://problem/10140300> llvm-svn: 143630
* 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
OpenPOWER on IntegriCloud