summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Enhance the memdep interface so that users can tell the difference between a ↵Eli Friedman2011-10-131-5/+5
| | | | | | | | 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
* Misc analysis passes that need to be aware of atomic load/store.Eli Friedman2011-08-151-10/+26
| | | | llvm-svn: 137650
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-1/+1
| | | | llvm-svn: 135375
* Add a limit to the number of instructions memdep will scan in a single ↵Eli Friedman2011-06-151-1/+22
| | | | | | | | | | block. This prevents (at least in some cases) O(N^2) runtime in passes like DSE. The limit in this patch is probably too high, but it is enough to stop DSE from going completely insane on a testcase I have (which has a single block with around 50,000 non-aliasing stores in it). rdar://9471075 llvm-svn: 133111
* Add "unknown" results for memdep, which mean "I don't know whether a ↵Eli Friedman2011-06-151-22/+18
| | | | | | 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
* Disable the main feature of 130180, the elimination of loads that areDan Gohman2011-06-041-0/+6
| | | | | | | | | | redundant with partially-aliasing loads. When computing what portion of a clobbering load value is needed, it doesn't consider phi-translation which may have occurred between the clobbing load and the redundant load. llvm-svn: 132631
* When marking a block as being unanalyzable, use "Clobber" on the terminator ↵Eli Friedman2011-06-021-2/+2
| | | | | | | | | | | | instead of the first instruction in the block. This is a bit of a hack; "Clobber" isn't really the right marking in the first place. memdep doesn't really have any way of properly expressing "unanalyzable" at the moment. Using it on the terminator is much less ambiguous than using it on an arbitrary instruction, though. In the given testcase, the "Clobber" was pointing to a load, and GVN was incorrectly assuming that meant that the "Clobber" load overlapped the load being analyzed (when they are actually unrelated). The included testcase tests both this commit and r132434. Part two of rdar://9429882. (r132434 was mislabeled.) llvm-svn: 132442
* In MemoryDependenceAnalysis::getNonLocalPointerDepFromBB, if a given block ↵Eli Friedman2011-06-011-20/+58
| | | | | | | | is is deemed unanalyzable (and we execute one of the "goto PredTranslationFailure" statements), make sure we don't put information about the predecessors of that block into the returned data structures; this can lead to, among other things, extraneous results (which will confuse passes using memdep). Fixes an assert in GVN compiling ruby. Part of rdar://problem/9521954 . Testcase coming up soon. llvm-svn: 132434
* @llvm.lifetime.begin acts as a load, not @llvm.lifetime.end.Owen Anderson2011-05-171-1/+1
| | | | llvm-svn: 131437
* teach GVN to widen integer loads when they are overaligned, when doing an Chris Lattner2011-04-281-10/+31
| | | | | | | | | | | wider load would allow elimination of subsequent loads, and when the wider load is still a native integer type. This eliminates a ton of loads on various benchmarks involving struct fields, though it is somewhat hobbled by clang not being very aggressive about field alignment. This is yet another step along the way towards resolving PR6627. llvm-svn: 130390
* Enhance memdep to return clobber relation between noalias loads whenChris Lattner2011-04-261-3/+95
| | | | | | | | | | | | | | | | an earlier load could be widened to encompass a later load. For example, if we see: X = load i8* P, align 4 Y = load i8* (P+3), align 1 and we have a 32-bit native integer type, we can widen the former load to i32 which then makes the second load redundant. GVN can't actually do anything with this load/load relation yet, so this isn't testable, but it is the next step to resolving PR6627, and a fairly general class of "merge neighboring loads" missed optimizations. llvm-svn: 130250
* use AA::isMustAlias to simplify some calls.Chris Lattner2011-04-261-5/+3
| | | | llvm-svn: 130248
* remove support for llvm.invariant.end from memdep. It is a Chris Lattner2011-04-261-37/+0
| | | | | | work-in-progress that is not progressing, and it has issues. llvm-svn: 130247
* Enhance MemDep: When alias analysis returns a partial alias result,Chris Lattner2011-04-261-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | return it as a clobber. This allows GVN to do smart things. Enhance GVN to be smart about the case when a small load is clobbered by a larger overlapping load. In this case, forward the value. This allows us to compile stuff like this: int test(void *P) { int tmp = *(unsigned int*)P; return tmp+*((unsigned char*)P+1); } into: _test: ## @test movl (%rdi), %ecx movzbl %ch, %eax addl %ecx, %eax ret which has one load. We already handled the case where the smaller load was from a must-aliased base pointer. llvm-svn: 130180
* Give GetUnderlyingObject a TargetData, to keep it in syncDan Gohman2011-01-241-1/+1
| | | | | | | | | | | 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
* Revert r123207: "Turn on memdep's verifyRemoved() in an attempt to smoke out ↵Jakob Stoklund Olesen2011-01-111-3/+1
| | | | | | | | the cause of our gcc bootstrap miscompare." It didn't. llvm-svn: 123215
* Turn on memdep's verifyRemoved() in an attempt to smoke out the cause of our ↵Jakob Stoklund Olesen2011-01-111-1/+3
| | | | | | gcc bootstrap miscompare. llvm-svn: 123207
* Change all self assignments X=X to (void)X, so that we can turn on aJeffrey Yasskin2010-12-231-1/+1
| | | | | | | new gcc warning that complains on self-assignments and self-initializations. llvm-svn: 122458
* Move Value::getUnderlyingObject to be a standaloneDan Gohman2010-12-151-1/+2
| | | | | | | function so that it can live in Analysis instead of VMCore. llvm-svn: 121885
* Update memdep to handle PartialAlias as MayAlias.Dan Gohman2010-12-131-4/+4
| | | | llvm-svn: 121723
* strength reduce this.Chris Lattner2010-11-301-1/+1
| | | | llvm-svn: 120381
* Initialize MemDep's TD member so buildbots don't trip over an uninitialized ↵Benjamin Kramer2010-11-211-0/+2
| | | | | | | | pointer (TD is passed to PHITransAddr). I wonder why this didn't explode earlier. llvm-svn: 119944
* implement PR8576, deleting dead stores with intervening may-alias stores.Chris Lattner2010-11-211-2/+2
| | | | llvm-svn: 119927
* Add helper functions for computing the Location of load, store,Dan Gohman2010-11-111-20/+6
| | | | | | and vaarg instructions. llvm-svn: 118845
* It's not necessary to clear out the Size and TBAATag at each ofDan Gohman2010-11-111-12/+1
| | | | | | these points. llvm-svn: 118752
* Set NonLocalDepInfo's Size field to UnknownSize when invalidatingDan Gohman2010-11-111-5/+5
| | | | | | it, so that it doesn't appear to be a known size. llvm-svn: 118748
* When clearing a non-local pointer dependency cache entry, clearDan Gohman2010-11-101-0/+8
| | | | | | the reverse map too. This fixes seflhost build errors. llvm-svn: 118729
* Factor out the code for computing an AliasAnalysis::LocationDan Gohman2010-11-101-82/+101
| | | | | | for a given instruction into a helper function. llvm-svn: 118723
* Fully invalidate cached results when a prior query's size orDan Gohman2010-11-101-10/+23
| | | | | | type is insufficient for, or incompatible with, the current query. llvm-svn: 118721
* Enhance GVN to do more precise alias queries for non-local memoryDan Gohman2010-11-101-9/+38
| | | | | | | | | | | | | | | references. For example, this allows gvn to eliminate the load in this example: void foo(int n, int* p, int *q) { p[0] = 0; p[1] = 1; if (n) { *q = p[0]; } } llvm-svn: 118714
* Teach memdep to use pointsToConstantMemory to determine that loadsDan Gohman2010-10-291-5/+10
| | | | | | from constant memory don't alias any stores. llvm-svn: 117636
* Get rid of static constructors for pass registration. Instead, every pass ↵Owen Anderson2010-10-191-0/+1
| | | | | | | | | | | | | | | | | 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
* Begin adding static dependence information to passes, which will allow us toOwen Anderson2010-10-121-1/+4
| | | | | | | | | 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
* Teach memdep about TBAA tags.Dan Gohman2010-09-221-71/+95
| | | | llvm-svn: 114588
* cleanup some of the lifetime/invariant marker stuff, add a big fixme.Chris Lattner2010-09-061-6/+11
| | | | llvm-svn: 113144
* speed up -gvn 3.4% on the testcase in PR7023Chris Lattner2010-09-061-1/+1
| | | | llvm-svn: 113135
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110460
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | llvm-svn: 110410
* Don't use PassInfo* as a type identifier for passes. Instead, use the ↵Owen Anderson2010-08-051-1/+1
| | | | | | | | address of the static ID member as the sole unique type identifier. Clean up APIs related to this change. llvm-svn: 110396
* Fix memdep's code for reasoning about dependences between two calls. A RefDan Gohman2010-08-051-19/+8
| | | | | | | | | | response from getModRefInfo is not useful here. Instead, check for identical calls only in the NoModRef case. Reapply r110270, and strengthen it to compensate for the memdep changes. When both calls are readonly, there is no dependence between them. llvm-svn: 110382
* Add a convenient form of AliasAnalysis::alias for the case where the sizesDan Gohman2010-08-031-4/+2
| | | | | | are unknown. llvm-svn: 110090
* reintroduce original (asserting) semantics of CallSite(Instruction *II)Gabor Greif2010-07-271-1/+1
| | | | | | | add instead a CallSite(Value* V) constructor that is consistent with ImmutableCallSize and use that one in client code llvm-svn: 109553
* recommit simplification (originally r109504, backed out in r109508) now that ↵Gabor Greif2010-07-271-3/+2
| | | | | | problem in CallSiteBase is fixed llvm-svn: 109547
* back out r109504, breaks the botsGabor Greif2010-07-271-2/+3
| | | | llvm-svn: 109508
* simplifyGabor Greif2010-07-271-3/+2
| | | | llvm-svn: 109504
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+2
| | | | llvm-svn: 109045
* use the new isFreeCall API and ArgOperand accessorsGabor Greif2010-06-231-12/+13
| | | | llvm-svn: 106692
* Use pre-increment instead of post-increment when the result is not used.Dan Gohman2010-06-221-2/+2
| | | | llvm-svn: 106542
* Revert 101465, it broke internal OpenGL testing.Eric Christopher2010-04-161-9/+9
| | | | | | | Probably the best way to know that all getOperand() calls have been handled is to replace that API instead of updating. llvm-svn: 101579
OpenPOWER on IntegriCloud