aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/MemoryDependenceAnalysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Misc analysis passes that need to be aware of atomic load/store.Eli Friedman2011-08-151-10/+26
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137650 91177308-0d34-0410-b5e6-96231b3b80d8
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133111 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133031 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132631 91177308-0d34-0410-b5e6-96231b3b80d8
* 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.) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132442 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132434 91177308-0d34-0410-b5e6-96231b3b80d8
* @llvm.lifetime.begin acts as a load, not @llvm.lifetime.end.Owen Anderson2011-05-171-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131437 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130390 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130250 91177308-0d34-0410-b5e6-96231b3b80d8
* use AA::isMustAlias to simplify some calls.Chris Lattner2011-04-261-5/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130248 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130247 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130180 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124134 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123215 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123207 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122458 91177308-0d34-0410-b5e6-96231b3b80d8
* Move Value::getUnderlyingObject to be a standaloneDan Gohman2010-12-151-1/+2
| | | | | | | | function so that it can live in Analysis instead of VMCore. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121885 91177308-0d34-0410-b5e6-96231b3b80d8
* Update memdep to handle PartialAlias as MayAlias.Dan Gohman2010-12-131-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121723 91177308-0d34-0410-b5e6-96231b3b80d8
* strength reduce this.Chris Lattner2010-11-301-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120381 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119944 91177308-0d34-0410-b5e6-96231b3b80d8
* implement PR8576, deleting dead stores with intervening may-alias stores.Chris Lattner2010-11-211-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119927 91177308-0d34-0410-b5e6-96231b3b80d8
* Add helper functions for computing the Location of load, store,Dan Gohman2010-11-111-20/+6
| | | | | | | and vaarg instructions. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118845 91177308-0d34-0410-b5e6-96231b3b80d8
* It's not necessary to clear out the Size and TBAATag at each ofDan Gohman2010-11-111-12/+1
| | | | | | | these points. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118752 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118748 91177308-0d34-0410-b5e6-96231b3b80d8
* When clearing a non-local pointer dependency cache entry, clearDan Gohman2010-11-101-0/+8
| | | | | | | the reverse map too. This fixes seflhost build errors. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118729 91177308-0d34-0410-b5e6-96231b3b80d8
* Factor out the code for computing an AliasAnalysis::LocationDan Gohman2010-11-101-82/+101
| | | | | | | for a given instruction into a helper function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118723 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118721 91177308-0d34-0410-b5e6-96231b3b80d8
* 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]; } } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118714 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach memdep to use pointsToConstantMemory to determine that loadsDan Gohman2010-10-291-5/+10
| | | | | | | from constant memory don't alias any stores. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117636 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116820 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116334 91177308-0d34-0410-b5e6-96231b3b80d8
* Now with fewer extraneous semicolons!Owen Anderson2010-10-071-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115996 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach memdep about TBAA tags.Dan Gohman2010-09-221-71/+95
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114588 91177308-0d34-0410-b5e6-96231b3b80d8
* cleanup some of the lifetime/invariant marker stuff, add a big fixme.Chris Lattner2010-09-061-6/+11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113144 91177308-0d34-0410-b5e6-96231b3b80d8
* speed up -gvn 3.4% on the testcase in PR7023Chris Lattner2010-09-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113135 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r110396, with fixes to appease the Linux buildbot gods.Owen Anderson2010-08-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110460 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r110396 to fix buildbots.Owen Anderson2010-08-061-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110410 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110396 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110382 91177308-0d34-0410-b5e6-96231b3b80d8
* Add a convenient form of AliasAnalysis::alias for the case where the sizesDan Gohman2010-08-031-4/+2
| | | | | | | are unknown. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110090 91177308-0d34-0410-b5e6-96231b3b80d8
* 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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109553 91177308-0d34-0410-b5e6-96231b3b80d8
* recommit simplification (originally r109504, backed out in r109508) now that ↵Gabor Greif2010-07-271-3/+2
| | | | | | problem in CallSiteBase is fixed git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109547 91177308-0d34-0410-b5e6-96231b3b80d8
* back out r109504, breaks the botsGabor Greif2010-07-271-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109508 91177308-0d34-0410-b5e6-96231b3b80d8
* simplifyGabor Greif2010-07-271-3/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109504 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix batch of converting RegisterPass<> to INTIALIZE_PASS().Owen Anderson2010-07-211-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@109045 91177308-0d34-0410-b5e6-96231b3b80d8
* use the new isFreeCall API and ArgOperand accessorsGabor Greif2010-06-231-12/+13
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106692 91177308-0d34-0410-b5e6-96231b3b80d8
* Use pre-increment instead of post-increment when the result is not used.Dan Gohman2010-06-221-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106542 91177308-0d34-0410-b5e6-96231b3b80d8
* 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101579 91177308-0d34-0410-b5e6-96231b3b80d8
* reapply r101434Gabor Greif2010-04-161-9/+9
| | | | | | | | | | | | | | with a fix for self-hosting rotate CallInst operands, i.e. move callee to the back of the operand array the motivation for this patch are laid out in my mail to llvm-commits: more efficient access to operands and callee, faster callgraph-construction, smaller compiler binary git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101465 91177308-0d34-0410-b5e6-96231b3b80d8