summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* 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. llvm-svn: 59940
* 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. llvm-svn: 59934
* 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. llvm-svn: 56922
* s/ParameterAttributes/Attributes/gDevang Patel2008-09-231-1/+0
| | | | llvm-svn: 56513
* Tidy up several unbeseeming casts from pointer to intptr_t.Dan Gohman2008-09-041-3/+3
| | | | llvm-svn: 55779
* simplify some code by using a helper function. This really reallyChris Lattner2008-06-161-22/+16
| | | | | | wants a 'nocapture' predicate. llvm-svn: 52304
* move a bunch of predicates up into their own sectionChris Lattner2008-06-161-157/+171
| | | | | | in this file, no other changes. llvm-svn: 52303
* Other parts of this code treat noalias arguments as objects forChris Lattner2008-06-161-4/+8
| | | | | | the purposes of escape analysis. llvm-svn: 52302
* 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 llvm-svn: 52301
* 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. llvm-svn: 52299
* 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. llvm-svn: 51875
* 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. llvm-svn: 51017
* Fix a "large integer implicitly truncated to unsigned type"Duncan Sands2008-04-211-1/+1
| | | | | | warning. llvm-svn: 50033
* 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. llvm-svn: 49731
* Restore isCFGOnly property of various analysis passes.Devang Patel2008-03-201-1/+1
| | | | llvm-svn: 48579
* PassInfo keep tracks whether a pass is an analysis pass or not.Devang Patel2008-03-191-2/+2
| | | | llvm-svn: 48554
* Fix a compiler warning.Duncan Sands2008-02-191-1/+1
| | | | llvm-svn: 47328
* 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. llvm-svn: 47317
* don't bother calling getUnderlyingObject for non-pointers.Chris Lattner2008-02-181-1/+2
| | | | llvm-svn: 47272
* 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. llvm-svn: 47268
* This check is not correct for mallocs, so exclude them earlier.Owen Anderson2008-02-181-2/+2
| | | | llvm-svn: 47263
* 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. llvm-svn: 47253
* Fix bugs that Chris noticed in my last patch.Owen Anderson2008-02-181-9/+17
| | | | llvm-svn: 47252
* 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. llvm-svn: 47250
* 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. llvm-svn: 47247
* getUnderlyingObject can return null, handle this.Chris Lattner2008-01-241-2/+3
| | | | llvm-svn: 46318
* 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. llvm-svn: 46315
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-291-2/+2
| | | | llvm-svn: 45418
* 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. llvm-svn: 44999
* Fix PR1782, patch by Wojtek Matyjewicz!Chris Lattner2007-12-091-4/+4
| | | | llvm-svn: 44733
* 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). llvm-svn: 44544
* 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. llvm-svn: 44487
* Add some convenience methods for querying attributes, andDuncan Sands2007-11-281-3/+2
| | | | | | use them. llvm-svn: 44403
* Fix PR1146: parameter attributes are longer part ofDuncan Sands2007-11-271-2/+2
| | | | | | | | | | | | the function type, instead they belong to functions and function calls. This is an updated and slightly corrected version of Reid Spencer's original patch. The only known problem is that auto-upgrading of bitcode files doesn't seem to work properly (see test/Bitcode/AutoUpgradeIntrinsics.ll). Hopefully a bitcode guru (who might that be? :) ) will fix it. llvm-svn: 44359
* Ding dong, the DoesntAccessMemoryFns andDuncan Sands2007-11-231-113/+0
| | | | | | | | | OnlyReadsMemoryFns tables are dead! We get more, and more accurate, information from gcc via the readnone and readonly function attributes. llvm-svn: 44288
* Teach alias analysis about readnone/readonly functions.Duncan Sands2007-11-221-0/+6
| | | | | | Based on a patch by Török Edwin. llvm-svn: 44279
* Fix for PR1801Tanya Lattner2007-11-161-0/+3
| | | | llvm-svn: 44193
* Fix PR1774 and BasicAA/2007-11-05-SizeCrash.llChris Lattner2007-11-061-7/+11
| | | | llvm-svn: 43756
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The meaning of getTypeSize was not clear - clarifying it is important now that we have x86 long double and arbitrary precision integers. The issue with long double is that it requires 80 bits, and this is not a multiple of its alignment. This gives a primitive type for which getTypeSize differed from getABITypeSize. For arbitrary precision integers it is even worse: there is the minimum number of bits needed to hold the type (eg: 36 for an i36), the maximum number of bits that will be overwriten when storing the type (40 bits for i36) and the ABI size (i.e. the storage size rounded up to a multiple of the alignment; 64 bits for i36). This patch removes getTypeSize (not really - it is still there but deprecated to allow for a gradual transition). Instead there is: (1) getTypeSizeInBits - a number of bits that suffices to hold all values of the type. For a primitive type, this is the minimum number of bits. For an i36 this is 36 bits. For x86 long double it is 80. This corresponds to gcc's TYPE_PRECISION. (2) getTypeStoreSizeInBits - the maximum number of bits that is written when storing the type (or read when reading it). For an i36 this is 40 bits, for an x86 long double it is 80 bits. This is the size alias analysis is interested in (getTypeStoreSize returns the number of bytes). There doesn't seem to be anything corresponding to this in gcc. (3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded up to a multiple of the alignment. For an i36 this is 64, for an x86 long double this is 96 or 128 depending on the OS. This is the spacing between consecutive elements when you form an array out of this type (getABITypeSize returns the number of bytes). This is TYPE_SIZE in gcc. Since successive elements in a SequentialType (arrays, pointers and vectors) need to be aligned, the spacing between them will be given by getABITypeSize. This means that the size of an array is the length times the getABITypeSize. It also means that GEP computations need to use getABITypeSize when computing offsets. Furthermore, if an alloca allocates several elements at once then these too need to be aligned, so the size of the alloca has to be the number of elements multiplied by getABITypeSize. Logically speaking this doesn't have to be the case when allocating just one element, but it is simpler to also use getABITypeSize in this case. So alloca's and mallocs should use getABITypeSize. Finally, since gcc's only notion of size is that given by getABITypeSize, if you want to output assembler etc the same as gcc then getABITypeSize is the size you want. Since a store will overwrite no more than getTypeStoreSize bytes, and a read will read no more than that many bytes, this is the notion of size appropriate for alias analysis calculations. In this patch I have corrected all type size uses except some of those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard cases). I will get around to auditing these too at some point, but I could do with some help. Finally, I made one change which I think wise but others might consider pointless and suboptimal: in an unpacked struct the amount of space allocated for a field is now given by the ABI size rather than getTypeStoreSize. I did this because every other place that reserves memory for a type (eg: alloca) now uses getABITypeSize, and I didn't want to make an exception for unpacked structs, i.e. I did it to make things more uniform. This only effects structs containing long doubles and arbitrary precision integers. If someone wants to pack these types more tightly they can always use a packed struct. llvm-svn: 43620
* Make a comment better.Owen Anderson2007-10-261-1/+3
| | | | llvm-svn: 43379
* Fix for PR1741.Owen Anderson2007-10-251-2/+3
| | | | llvm-svn: 43326
* Add lengthof and endof templates that hide a lot of sizeof computations.Owen Anderson2007-09-071-5/+4
| | | | | | Patch by Sterling Stein! llvm-svn: 41758
* Missing break. Patch by Wojciech Matyjewicz.Evan Cheng2007-09-051-0/+1
| | | | llvm-svn: 41727
* This resolves a regression of BasicAA which failed to find any memory ↵Chandler Carruth2007-08-061-4/+23
| | | | | | information for overloaded intrinsics (PR1600). This resolves that issue, and improves the matching scheme to use a BitVector rather than a binary search. llvm-svn: 40872
* Upgrade BasicAliasAnalysis::getModRefBehavior to not call Value::getName,Chris Lattner2007-08-051-4/+14
| | | | | | | which dynamically allocates the string result. This speeds up dse on the testcase from PR1432 from 0.3781s to 0.1804s (2.1x). llvm-svn: 40838
* Implement review feedback.Christopher Lamb2007-08-021-4/+4
| | | | llvm-svn: 40745
* Teach BasicAA about noalias parameter attributes, but do it correctly this time.Christopher Lamb2007-08-021-1/+31
| | | | llvm-svn: 40711
* Revert overly aggressive interpretation of noaliasChristopher Lamb2007-07-311-32/+1
| | | | llvm-svn: 40635
* Teach BasicAA about noalias function parameters. Passes all of DejaGNU and ↵Christopher Lamb2007-07-311-1/+32
| | | | | | test-suite. llvm-svn: 40624
* Fix comments about vectors to use the current wording.Dan Gohman2007-07-161-1/+1
| | | | llvm-svn: 39921
OpenPOWER on IntegriCloud