summaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicAliasAnalysis.cpp
Commit message (Collapse)AuthorAge
* Make BasicAliasAnalysis recognize the fact a noalias argument cannot alias ↵Michael Kuperstein2013-05-28
| | | | | | another argument, even if the other argument is not itself marked noalias. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@182755 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r176408 and r176407 to address PR15540.Nadav Rotem2013-04-09
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179111 91177308-0d34-0410-b5e6-96231b3b80d8
* BasicAA: Only query twice if the result of the more general query was MayAliasArnold Schwaighofer2013-03-26
| | | | | | | | | | | | | | This is a compile time optimization. Before the patch we would do two traversals on each call to aliasGEP - one with a set size parameter one with UnknownSize. We can do better by first checking the result of the alias query with UnknownSize. Only if this one returns MayAlias do we query a second time using size and type. This recovers an about 7% compile time regression on spec/ammp. radar://12349960 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178045 91177308-0d34-0410-b5e6-96231b3b80d8
* add getUnderlyingObjectSize()Nuno Lopes2013-03-02
| | | | | | | this is similar to getObjectSize(), but doesnt subtract the offset tweak the BasicAA code accordingly (per PR14988) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176407 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a problem in alias analysis. It is about the misinterpretation of "Object".Shuxin Yang2013-02-28
| | | | | | | | | | | | | | | | | | This problem is exposed by r171325 which is already reverted. It is rather hard to fabricate a testing case without it. r171325 should *NOT* be resurrected as it has a potential problem although this problem dosen't directly contribute to PR14988. The bug is tracked by: - rdar://13063553, and - http://llvm.org/bugs/show_bug.cgi?id=14988 Thank Arnold for coming up a better solution to this problem. After comparing this solution and my original proposal, I decided to ditch mine. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176225 91177308-0d34-0410-b5e6-96231b3b80d8
* Actually update the CMake and Makefile builds correctly, and update theChandler Carruth2013-01-02
| | | | | | | | | | code that includes Intrinsics.gen directly. This never showed up in my testing because the old Intrinsics.gen was still kicking around in the make build system and was correct there. =[ Thankfully, some of the bots to clean rebuilds and that caught this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171373 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-02
| | | | | | | | | | | | | | | | | | | | | into their new header subdirectory: include/llvm/IR. This matches the directory structure of lib, and begins to correct a long standing point of file layout clutter in LLVM. There are still more header files to move here, but I wanted to handle them in separate commits to make tracking what files make sense at each layer easier. The only really questionable files here are the target intrinsic tablegen files. But that's a battle I'd rather not fight today. I've updated both CMake and Makefile build systems (I think, and my tests think, but I may have missed something). I've also re-sorted the includes throughout the project. I'll be committing updates to Clang, DragonEgg, and Polly momentarily. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171366 91177308-0d34-0410-b5e6-96231b3b80d8
* Optimistically analyse Phi cyclesArnold Schwaighofer2012-12-10
| | | | | | | | | | Analyse Phis under the starting assumption that they are NoAlias. Recursively look at their inputs. If they MayAlias/MustAlias there must be an input that makes them so. Addresses bug 14351. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169788 91177308-0d34-0410-b5e6-96231b3b80d8
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-03
| | | | | | | | | | | | | | | | | Sooooo many of these had incorrect or strange main module includes. I have manually inspected all of these, and fixed the main module include to be the nearest plausible thing I could find. If you own or care about any of these source files, I encourage you to take some time and check that these edits were sensible. I can't have broken anything (I strictly added headers, and reordered them, never removed), but they may not be the headers you'd really like to identify as containing the API being implemented. Many forward declarations and missing includes were added to a header files to allow them to parse cleanly when included first. The main module rule does in fact have its merits. =] git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169131 91177308-0d34-0410-b5e6-96231b3b80d8
* Phi speculation improvement for BasicAAHal Finkel2012-11-17
| | | | | | | | | | | | This is a partial solution to PR14351. It removes some of the special significance of the first incoming phi value in the phi aliasing checking logic in BasicAA. In the context of a loop, the old logic assumes that the first incoming value is the interesting one (meaning that it is the one that comes from outside the loop), but this is often not the case. With this change, we now test first the incoming value that comes from a block other than the parent of the phi being tested. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168245 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't infer whether a value is captured in the current function from theRichard Osborne2012-11-05
| | | | | | | | | | 'nocapture' attribute. The nocapture attribute only specifies that no copies are made that outlive the function. This isn't the same as there being no copies at all. This fixes PR14045. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167381 91177308-0d34-0410-b5e6-96231b3b80d8
* Apply the patch from PR14160. I failed to construct a testcase for this, butDuncan Sands2012-11-04
| | | | | | | I'm applying it anyway since it seems to be obviously correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167370 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert the majority of the next patch in the address space series:Chandler Carruth2012-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r165941: Resubmit the changes to llvm core to update the functions to support different pointer sizes on a per address space basis. Despite this commit log, this change primarily changed stuff outside of VMCore, and those changes do not carry any tests for correctness (or even plausibility), and we have consistently found questionable or flat out incorrect cases in these changes. Most of them are probably correct, but we need to devise a system that makes it more clear when we have handled the address space concerns correctly, and ideally each pass that gets updated would receive an accompanying test case that exercises that pass specificaly w.r.t. alternate address spaces. However, from this commit, I have retained the new C API entry points. Those were an orthogonal change that probably should have been split apart, but they seem entirely good. In several places the changes were very obvious cleanups with no actual multiple address space code added; these I have not reverted when I spotted them. In a few other places there were merge conflicts due to a cleaner solution being implemented later, often not using address spaces at all. In those cases, I've preserved the new code which isn't address space dependent. This is part of my ongoing effort to clean out the partial address space code which carries high risk and low test coverage, and not likely to be finished before the 3.2 release looms closer. Duncan and I would both like to see the above issues addressed before we return to these changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@167222 91177308-0d34-0410-b5e6-96231b3b80d8
* Resubmit the changes to llvm core to update the functions to support ↵Micah Villmow2012-10-15
| | | | | | different pointer sizes on a per address space basis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165941 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 165732 for further review.Micah Villmow2012-10-11
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165747 91177308-0d34-0410-b5e6-96231b3b80d8
* Add in the first iteration of support for llvm/clang/lldb to allow variable ↵Micah Villmow2012-10-11
| | | | | | per address space pointer sizes to be optimized correctly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165726 91177308-0d34-0410-b5e6-96231b3b80d8
* Move TargetData to DataLayout.Micah Villmow2012-10-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165402 91177308-0d34-0410-b5e6-96231b3b80d8
* GCC doesn't understand that OrigAliasResult having a value is correlated withDuncan Sands2012-09-19
| | | | | | | | ArePhisAssumedNoAlias, and warns that OrigAliasResult may be used uninitialized. Pacify GCC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@164229 91177308-0d34-0410-b5e6-96231b3b80d8
* BasicAA: Recognize cyclic NoAlias phisArnold Schwaighofer2012-09-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enhances basic alias analysis to recognize phis whose first incoming values are NoAlias and whose other incoming values are just the phi node itself through some amount of recursion. Example: With this change basicaa reports that ptr_phi and ptr_phi2 do not alias each other. bb: ptr = ptr2 + 1 loop: ptr_phi = phi [bb, ptr], [loop, ptr_plus_one] ptr2_phi = phi [bb, ptr2], [loop, ptr2_plus_one] ... ptr_plus_one = gep ptr_phi, 1 ptr2_plus_one = gep ptr2_phi, 1 This enables the elimination of one load in code like the following: extern int foo; int test_noalias(int *ptr, int num, int* coeff) { int *ptr2 = ptr; int result = (*ptr++) * (*coeff--); while (num--) { *ptr2++ = *ptr; result += (*coeff--) * (*ptr++); } *ptr = foo; return result; } Part 2/2 of fix for PR13564. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163319 91177308-0d34-0410-b5e6-96231b3b80d8
* BasicAA: GEPs of NoAlias'ing base ptr with equivalent indices are NoAliasArnold Schwaighofer2012-09-06
| | | | | | | | | | | | | | If we can show that the base pointers of two GEPs don't alias each other using precise analysis and the indices and base offset are equal then the two GEPs also don't alias each other. This is primarily needed for the follow up patch that analyses NoAlias'ing PHI nodes. Part 1/2 of fix for PR13564. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163317 91177308-0d34-0410-b5e6-96231b3b80d8
* Switch BasicAliasAnalysis' cache to SmallDenseMap.Benjamin Kramer2012-09-05
| | | | | | | | It relies on clear() being fast and the cache rarely has more than 1 or 2 elements, so give it an inline capacity and always shrink it back down in case it grows. DenseMap will grow to 64 buckets which makes clear() a lot slower. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163215 91177308-0d34-0410-b5e6-96231b3b80d8
* Make MemoryBuiltins aware of TargetLibraryInfo.Benjamin Kramer2012-08-29
| | | | | | | | | | | | | | | | This disables malloc-specific optimization when -fno-builtin (or -ffreestanding) is specified. This has been a problem for a long time but became more severe with the recent memory builtin improvements. Since the memory builtin functions are used everywhere, this required passing TLI in many places. This means that functions that now have an optional TLI argument, like RecursivelyDeleteTriviallyDeadFunctions, won't remove dead mallocs anymore if the TLI argument is missing. I've updated most passes to do the right thing. Fixes PR13694 and probably others. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162841 91177308-0d34-0410-b5e6-96231b3b80d8
* refactor the MemoryBuiltin analysis:Nuno Lopes2012-06-21
| | | | | | | | | | | | - provide more extensive set of functions to detect library allocation functions (e.g., malloc, calloc, strdup, etc) - provide an API to compute the size and offset of an object pointed by Move a few clients (GVN, AA, instcombine, ...) to the new API. This implementation is a lot more aggressive than each of the custom implementations being replaced. Patch reviewed by Nick Lewycky and Chandler Carruth, thanks. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@158919 91177308-0d34-0410-b5e6-96231b3b80d8
* Duncan pointed out that if the alignment isn't explicitly specified, it ↵Eli Friedman2012-02-27
| | | | | | defaults to the ABI alignment. Given that, make this code a bit more aggressive in such cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151584 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach BasicAA about the LLVM IR rules that allow reading past the end of an ↵Eli Friedman2012-02-27
| | | | | | object given sufficient alignment. Fixes PR12098. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151553 91177308-0d34-0410-b5e6-96231b3b80d8
* Move isKnownNonNull from private implementation detail of BasicAA to a publicNick Lewycky2012-02-25
| | | | | | | function that others can use, next to llvm::isIdentifiedObject. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151446 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove a comment about an alternative approach that wouldn'tDan Gohman2012-02-17
| | | | | | | | | actually work, at least as described. LLVM Metadata is not intended to suppress LLVM IR rules, as it can be stripped at any time. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@150821 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.Nick Lewycky2011-11-20
| | | | | | | | | Suggested in code review by Eli. That code in InstCombine looks kinda suspicious. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145013 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the old atomic instrinsics. autoupgrade functionality is included ↵Eli Friedman2011-10-06
| | | | | | with this patch. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141333 91177308-0d34-0410-b5e6-96231b3b80d8
* PR10628: Fix getModRefInfo so it queries the underlying alias() ↵Eli Friedman2011-09-28
| | | | | | implementation correctly while checking nocapture calls. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140666 91177308-0d34-0410-b5e6-96231b3b80d8
* A couple minor corrections to r139276.Eli Friedman2011-09-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139277 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the logic in BasicAliasAnalysis::aliasGEP for comparing GEP's with ↵Eli Friedman2011-09-08
| | | | | | variable differences so that it actually does something sane. Fixes PR10881. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139276 91177308-0d34-0410-b5e6-96231b3b80d8
* memset_pattern16 uses a 16 BYTE pattern, not a 16 BIT pattern. Add comments ↵Owen Anderson2011-09-06
| | | | | | to that effect. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139205 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach BasicAA about the aliasing properties of memset_pattern16.Owen Anderson2011-09-06
| | | | | | | Fixes PR10872 and <rdar://problem/10065079>. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139204 91177308-0d34-0410-b5e6-96231b3b80d8
* Explicitly cast narrowing conversions inside {}s that will become errors inJeffrey Yasskin2011-07-27
| | | | | | C++0x. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136211 91177308-0d34-0410-b5e6-96231b3b80d8
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-18
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135375 91177308-0d34-0410-b5e6-96231b3b80d8
* Initialize BasicAA's AliasCache to set it to use fewer buckets byDan Gohman2011-06-10
| | | | | | | | | default, since it usually has very few elements. This speeds up alias queries in many cases, because AliasCache.clear() doesn't have to visit as many buckets. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132862 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r131781, now that the GVN bug with partially-aliasing loadsDan Gohman2011-06-04
| | | | | | | is disabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132632 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r131781 again. Apparently there is more going on here.Dan Gohman2011-06-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132625 91177308-0d34-0410-b5e6-96231b3b80d8
* Reapply r131781 (revert r131809), now that some BasicAA shortcomingsDan Gohman2011-06-04
| | | | | | | it exposed are fixed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132611 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix BasicAA's recursion detection so that it doesn't pessimizeDan Gohman2011-06-04
| | | | | | | | | | queries in the case of a DAG, where a query reaches a node visited earlier, but it's not on a cycle. This avoids MayAlias results in cases where BasicAA is expected to return MustAlias or PartialAlias in order to protect TBAA. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132609 91177308-0d34-0410-b5e6-96231b3b80d8
* When merging MustAlias and PartialAlias, chose PartialAlias insteadDan Gohman2011-06-03
| | | | | | | of conservatively choosing MayAlias. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132579 91177308-0d34-0410-b5e6-96231b3b80d8
* Make DecomposeGEPExpression check SimplifyInstruction onlyDan Gohman2011-05-24
| | | | | | | | | after checking for a GEP, so that it matches what GetUnderlyingObject does. This fixes an obscure bug turned up by bugpoint in the testcase for PR9931. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131971 91177308-0d34-0410-b5e6-96231b3b80d8
* fix a really nasty basicaa mod/ref calculation bug that was causing ↵Chris Lattner2011-05-23
| | | | | | | | | miscompilation of UnitTests/ObjC/messages-2.m with the recent optimizer improvements. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131897 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert commit 131781, to see if it fixes the x86-64 dragonegg buildbot.Duncan Sands2011-05-21
| | | | | | | | | | Original log message: When BasicAA can determine that two pointers have the same base but differ by a dynamic offset, return PartialAlias instead of MayAlias. See the comment in the code for details. This fixes PR9971. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131809 91177308-0d34-0410-b5e6-96231b3b80d8
* When BasicAA can determine that two pointers have the same base butDan Gohman2011-05-21
| | | | | | | | differ by a dynamic offset, return PartialAlias instead of MayAlias. See the comment in the code for details. This fixes PR9971. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131781 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach BasicAA about arm.neon.vld1 and vst1.Dan Gohman2011-04-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130327 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a ton of comment typos found by codespell. Patch byChris Lattner2011-04-15
| | | | | | | | Luis Felipe Strano Moraes! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129558 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r128140 for now.Anders Carlsson2011-03-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128149 91177308-0d34-0410-b5e6-96231b3b80d8
* A global variable with internal linkage where all uses are in one function ↵Anders Carlsson2011-03-23
| | | | | | and whose address is never taken is a non-escaping local object and can't alias anything else. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128140 91177308-0d34-0410-b5e6-96231b3b80d8