aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis/BasicAliasAnalysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Generalize some alias analysis logic from atomicDuncan Sands2009-02-141-51/+0
| | | | | | | intrinsics to any IntrWriteArgMem intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64551 91177308-0d34-0410-b5e6-96231b3b80d8
* BasicAA was making the assumption that a local allocation which hadn't escapedNick Lewycky2009-02-131-3/+3
| | | | | | | | | couldn't ever be the return of call instruction. However, it's quite possible that said local allocation is itself the return of a function call. That's what malloc and calloc are for, actually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64442 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor my previous change to maintain the distinction between ↵Owen Anderson2009-02-051-21/+52
| | | | | | | | | AliasAnalysis and BasicAliasAnalysis. This involves some wider changes because it folds away some never-used methods. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63900 91177308-0d34-0410-b5e6-96231b3b80d8
* Finish making AliasAnalysis aware of the fact that most atomic intrinsics ↵Owen Anderson2009-02-041-0/+16
| | | | | | | | | only dereference their arguments, and enhance BasicAA to make use of this fact when computing ModRef info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63718 91177308-0d34-0410-b5e6-96231b3b80d8
* Move isIdentifiedObject and isNoAliasCall into AliasAnalysis.cpp sinceDan Gohman2009-02-031-24/+0
| | | | | | | | | they are useful to analyses other than BasicAliasAnalysis.cpp. Include the full comment for isIdentifiedObject in the header file. Thanks to Chris for suggeseting this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63589 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a post-RA scheduling dependency bug.Dan Gohman2009-01-301-1/+1
| | | | | | | | | | | | | | | | If a MachineInstr doesn't have a memoperand but has an opcode that is known to load or store, assume its memory reference may alias *anything*, including stack slots which the compiler completely controls. To partially compensate for this, teach the ScheduleDAG building code to do basic getUnderlyingValue analysis. This greatly reduces the number of instructions that require restrictive dependencies. This code will need to be revisited when we start doing real alias analysis, but it should suffice for now. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63370 91177308-0d34-0410-b5e6-96231b3b80d8
* BasicAliasAnalysis and FunctionAttrs were bothDuncan Sands2009-01-181-52/+3
| | | | | | | | | | doing very similar pointer capture analysis. Factor out the common logic. The new version is from FunctionAttrs since it does a better job than the version in BasicAliasAnalysis git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62461 91177308-0d34-0410-b5e6-96231b3b80d8
* add a commentGabor Greif2009-01-181-0/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62436 91177308-0d34-0410-b5e6-96231b3b80d8
* Rename getABITypeSize to getTypePaddedSize, asDuncan Sands2009-01-121-1/+1
| | | | | | | suggested by Chris. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62099 91177308-0d34-0410-b5e6-96231b3b80d8
* make tblgen autogenerate the nocapture intrinsics for Chris Lattner2009-01-121-4/+0
| | | | | | | | llvm.memcpy/memset/memmove. This allows removal of some hackish code from basicaa. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62071 91177308-0d34-0410-b5e6-96231b3b80d8
* When checking if an Argument escapes, check ifDuncan Sands2009-01-051-7/+13
| | | | | | | | | the argument is marked nocapture - no need to analyze the argument if the answer is already known! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61753 91177308-0d34-0410-b5e6-96231b3b80d8
* Resubmit support for the 'nocapture' attribute.Nick Lewycky2008-12-191-6/+17
| | | | | | | | | | | The problematic part of this patch is that we were out of attribute bits, requiring some fancy bit hacking to make it fit (by shrinking alignment) without breaking existing users or the file format. This change will require users to rebuild llvm-gcc to match llvm. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61239 91177308-0d34-0410-b5e6-96231b3b80d8
* Temporarily revert r61019, r61030, and r61040. These were breaking LLVM ReleaseBill Wendling2008-12-161-17/+6
| | | | | | | builds. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61094 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach basicaa to use the nocapture attribute when possible. When theChris Lattner2008-12-151-6/+17
| | | | | | | | intrinsics are properly marked nocapture, the fixme should be addressed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61040 91177308-0d34-0410-b5e6-96231b3b80d8
* Allow basicaa to walk through geps with identical indices in Chris Lattner2008-12-101-18/+32
| | | | | | | | | | | | | parallel, allowing it to decide that P/Q must alias if A/B must alias in things like: P = gep A, 0, i, 1 Q = gep B, 0, i, 1 This allows GVN to delete 62 more instructions out of 403.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60820 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach BasicAA::getModRefInfo(CallSite, CallSite) someChris Lattner2008-12-091-4/+20
| | | | | | | | | | | | | | | | | | | | | | | tricks based on readnone/readonly functions. Teach memdep to look past readonly calls when analyzing deps for a readonly call. This allows elimination of a few more calls from 403.gcc: before: 63 gvn - Number of instructions PRE'd 153986 gvn - Number of instructions deleted 50069 gvn - Number of loads deleted after: 63 gvn - Number of instructions PRE'd 153991 gvn - Number of instructions deleted 50069 gvn - Number of loads deleted 5 calls isn't much, but this adds plumbing for the next change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60794 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix comment typo.Duncan Sands2008-12-081-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60697 91177308-0d34-0410-b5e6-96231b3b80d8
* Some minor optimizations for isObjectSmallerThan.Chris Lattner2008-12-081-7/+12
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60687 91177308-0d34-0410-b5e6-96231b3b80d8
* Seriously strengthen the guarantee offered by noalias on a function's returnNick Lewycky2008-11-241-3/+3
| | | | | | | | | value. It must now be as if the pointer were allocated and has not escaped to the caller. Thanks to Dan Gohman for pointing out the error in the original and helping devise this definition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59940 91177308-0d34-0410-b5e6-96231b3b80d8
* Extend the 'noalias' attribute to function return values. This is intended toNick Lewycky2008-11-241-8/+17
| | | | | | | | | | indicate functions that allocate, such as operator new, or list::insert. The actual definition is slightly less strict (for now). No changes to the bitcode reader/writer, asm printer or verifier were needed. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@59934 91177308-0d34-0410-b5e6-96231b3b80d8
* Factorize code: remove variants of "strip offDuncan Sands2008-10-011-28/+4
| | | | | | | | | | | | pointer bitcasts and GEP's", and centralize the logic in Value::getUnderlyingObject. The difference with stripPointerCasts is that stripPointerCasts only strips GEPs if all indices are zero, while getUnderlyingObject strips GEPs no matter what the indices are. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56922 91177308-0d34-0410-b5e6-96231b3b80d8
* s/ParameterAttributes/Attributes/gDevang Patel2008-09-231-1/+0
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@56513 91177308-0d34-0410-b5e6-96231b3b80d8
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-3/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55779 91177308-0d34-0410-b5e6-96231b3b80d8
* simplify some code by using a helper function. This really reallyChris Lattner2008-06-161-22/+16
| | | | | | | wants a 'nocapture' predicate. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52304 91177308-0d34-0410-b5e6-96231b3b80d8
* move a bunch of predicates up into their own sectionChris Lattner2008-06-161-157/+171
| | | | | | | in this file, no other changes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52303 91177308-0d34-0410-b5e6-96231b3b80d8
* Other parts of this code treat noalias arguments as objects forChris Lattner2008-06-161-4/+8
| | | | | | | the purposes of escape analysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52302 91177308-0d34-0410-b5e6-96231b3b80d8
* If we are checking to see if the result of a call aliases aChris Lattner2008-06-161-1/+21
| | | | | | | | pointer derived from a local allocation, if the local allocation never escapes, the pointers can't alias. This implements PR2436 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52301 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor basicaa's main alias function somethin' fierce. Chris Lattner2008-06-161-104/+94
| | | | | | | | | | This fixes several minor bugs (such as returning noalias for comparisons between external weak functions an null) but is mostly a cleanup. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52299 91177308-0d34-0410-b5e6-96231b3b80d8
* Fixes PR2395. Looking for a constant in a GEP tail (when the first GEP Wojciech Matyjewicz2008-06-021-1/+7
| | | | | | | | | is longer than the second one) should stop after finding one. Added break instruction guarantees it. It also changes difference between offsets to absolute value of this difference in the condition. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51875 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-131-14/+14
| | | | | | | | several things that were neither in an anonymous namespace nor static but not intended to be global. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51017 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a "large integer implicitly truncated to unsigned type"Duncan Sands2008-04-211-1/+1
| | | | | | | warning. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50033 91177308-0d34-0410-b5e6-96231b3b80d8
* Don't assume a tail call can't reference a byvalDale Johannesen2008-04-151-2/+4
| | | | | | | | argument to the outer function, this isn't correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49731 91177308-0d34-0410-b5e6-96231b3b80d8
* Restore isCFGOnly property of various analysis passes.Devang Patel2008-03-201-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48579 91177308-0d34-0410-b5e6-96231b3b80d8
* PassInfo keep tracks whether a pass is an analysis pass or not.Devang Patel2008-03-191-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48554 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a compiler warning.Duncan Sands2008-02-191-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47328 91177308-0d34-0410-b5e6-96231b3b80d8
* In addition to arguments passed to it, memcpy (and all other calls) can ↵Owen Anderson2008-02-191-1/+2
| | | | | | ModRef pointers that alias their arguments as well. This fixes PR2057. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47317 91177308-0d34-0410-b5e6-96231b3b80d8
* don't bother calling getUnderlyingObject for non-pointers.Chris Lattner2008-02-181-1/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47272 91177308-0d34-0410-b5e6-96231b3b80d8
* Since we're not checking for the more general AllocationInst first, we need ↵Owen Anderson2008-02-181-1/+1
| | | | | | | | | to explicitly check that Object is an Argument before casting it to one. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47268 91177308-0d34-0410-b5e6-96231b3b80d8
* This check is not correct for mallocs, so exclude them earlier.Owen Anderson2008-02-181-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47263 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment, and a bug where we weren't applying the tail call logic in ↵Owen Anderson2008-02-181-6/+8
| | | | | | cases that failed the first test. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47253 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix bugs that Chris noticed in my last patch.Owen Anderson2008-02-181-9/+17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47252 91177308-0d34-0410-b5e6-96231b3b80d8
* bitcasts of pointers are always pointers.Chris Lattner2008-02-181-5/+2
| | | | | | | | If we see a memcpy of a pointer, make sure to check later uses of the pointer as well. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47250 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach getModRefInfo that memcpy, memmove, and memset don't "capture" memory ↵Owen Anderson2008-02-171-3/+13
| | | | | | | | | | addresses. Also, noalias arguments are be considered "like" stack allocated ones for this purpose, because the only way they can be modref'ed is if they escape somewhere in the current function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47247 91177308-0d34-0410-b5e6-96231b3b80d8
* getUnderlyingObject can return null, handle this.Chris Lattner2008-01-241-2/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46318 91177308-0d34-0410-b5e6-96231b3b80d8
* Teach basicaa that 'byval' arguments define a new memory location thatChris Lattner2008-01-241-34/+34
| | | | | | | | can't be aliased to other known objects. This allows us to know that byval pointer args don't alias globals, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@46315 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* Make these loops follow GetGEPOperands() behavior.Wojciech Matyjewicz2007-12-131-11/+13
| | | | | | | | | Let: %q = GEP %p, X, ... If %p is a GEP, we can chase baseptr further, only if X==0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44999 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix PR1782, patch by Wojtek Matyjewicz!Chris Lattner2007-12-091-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44733 91177308-0d34-0410-b5e6-96231b3b80d8
* Rather than having special rules like "intrinsics cannotDuncan Sands2007-12-031-37/+0
| | | | | | | | | | throw exceptions", just mark intrinsics with the nounwind attribute. Likewise, mark intrinsics as readnone/readonly and get rid of special aliasing logic (which didn't use anything more than this anyway). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44544 91177308-0d34-0410-b5e6-96231b3b80d8
* Integrate the readonly/readnone logic more deeplyDuncan Sands2007-12-011-5/+0
| | | | | | | | | | | | | | | | into alias analysis. This meant updating the API which now has versions of the getModRefBehavior, doesNotAccessMemory and onlyReadsMemory methods which take a callsite parameter. These should be used unless the callsite is not known, since in general they can do a better job than the versions that take a function. Also, users should no longer call the version of getModRefBehavior that takes both a function and a callsite. To reduce the chance of misuse it is now protected. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44487 91177308-0d34-0410-b5e6-96231b3b80d8