summaryrefslogtreecommitdiff
path: root/lib/Analysis/AliasAnalysis.cpp
Commit message (Collapse)AuthorAge
* Implement a proper getModRefInfo for va_arg.Dan Gohman2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110458 91177308-0d34-0410-b5e6-96231b3b80d8
* Be more conservative in the face of volatile.Dan Gohman2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110456 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a comment.Dan Gohman2010-08-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110455 91177308-0d34-0410-b5e6-96231b3b80d8
* Move all the logic for function attributes and call attributes out of theDan Gohman2010-08-06
| | | | | | | | | | | | | | AliasAnalysis base class and into BasicAliasAnalyais. This avoids confusion about where such logic is happening when there are other AliasAnalysis implementations present. Move the logic for translating two-callsite getModRefInfo queries into other AliasAnalysis queries out of BasicAliasAnalysis and into the AliasAnalysis base class, as it is useful for other AliasAnalysis implementations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110421 91177308-0d34-0410-b5e6-96231b3b80d8
* Yes, we can do better, but this is not the place for it.Dan Gohman2010-08-05
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110391 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove PointerAccessInfo, which nothing was using.Dan Gohman2010-08-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110167 91177308-0d34-0410-b5e6-96231b3b80d8
* Thread const correctness through a bunch of AliasAnalysis interfaces andDan Gohman2010-08-03
| | | | | | | | | | | | | eliminate several const_casts. Make CallSite implicitly convertible to ImmutableCallSite. Rename the getModRefBehavior for intrinsic IDs to getIntrinsicModRefBehavior to avoid overload ambiguity with CallSite, which happens to be implicitly convertible to bool. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110155 91177308-0d34-0410-b5e6-96231b3b80d8
* Make AliasAnalysis::getModRefInfo conservative in the face of volatility.Dan Gohman2010-08-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110120 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove interprocedural-basic-aa and associated code. The AliasAnalysisDan Gohman2010-07-07
| | | | | | | | | | | | interface needs implementations to be consistent, so any code which wants to support different semantics must use a different interface. It's not currently worthwhile to add a new interface for this new concept. Document that AliasAnalysis doesn't support cross-function queries. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107776 91177308-0d34-0410-b5e6-96231b3b80d8
* Add an Intraprocedural form of BasicAliasAnalysis, which aims toDan Gohman2010-06-29
| | | | | | | | properly handles instructions and arguments defined in different functions, or across recursive function iterations. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107109 91177308-0d34-0410-b5e6-96231b3b80d8
* Partially address a README by having functionattrs consider calls toDuncan Sands2010-01-06
| | | | | | | | | | | memcpy, memset and other intrinsics that only access their arguments to be readnone if the intrinsic's arguments all point to local memory. This improves the testcase in the README to readonly, but it could in theory be made readnone, however this would involve more sophisticated analysis that looks through the memcpy. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92829 91177308-0d34-0410-b5e6-96231b3b80d8
* use the new isNoAlias method to simplify some code, only do an escaping ↵Chris Lattner2009-11-23
| | | | | | | | | check if we have a non-constant pointer. Constant pointers can't be local. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89665 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove the AliasAnalysis::getMustAliases method, which is dead.Chris Lattner2009-11-22
| | | | | | | | | The hasNoModRefInfoForCalls isn't worth it as a filter because basicaa provides m/r info and everything chains to it, so remove it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89599 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove AllocationInst. Since MallocInst went away, AllocaInst is the only ↵Victor Hernandez2009-10-23
| | | | | | subclass of AllocationInst, so it no longer is necessary. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84969 91177308-0d34-0410-b5e6-96231b3b80d8
* Global Aliases are not identifiable objects.Dan Gohman2009-08-27
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80263 91177308-0d34-0410-b5e6-96231b3b80d8
* Make AliasAnalysis and related classes useDan Gohman2009-07-25
| | | | | | | getAnalysisIfAvailable<TargetData>(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77028 91177308-0d34-0410-b5e6-96231b3b80d8
* Generalize some alias analysis logic from atomicDuncan Sands2009-02-14
| | | | | | | intrinsics to any IntrWriteArgMem intrinsics. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64551 91177308-0d34-0410-b5e6-96231b3b80d8
* If a function only reads memory, then we know that...Duncan Sands2009-02-13
| | | | | | | | | it only reads memory! The other change has no functional effect, it just seems more logical to go in order of decreasing knowledge. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64463 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix a crasher: we need to check that the function is non-null before using it!Owen Anderson2009-02-06
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63902 91177308-0d34-0410-b5e6-96231b3b80d8
* Refactor my previous change to maintain the distinction between ↵Owen Anderson2009-02-05
| | | | | | | | | 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-04
| | | | | | | | | 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
* Teach AliasAnalysis that a bunch of the atomic intrinsics only dereference ↵Owen Anderson2009-02-03
| | | | | | their arguments. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63616 91177308-0d34-0410-b5e6-96231b3b80d8
* Move isIdentifiedObject and isNoAliasCall into AliasAnalysis.cpp sinceDan Gohman2009-02-03
| | | | | | | | | 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 copy+paste error in a comment.Dan Gohman2008-05-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51717 91177308-0d34-0410-b5e6-96231b3b80d8
* Clean up the use of static and anonymous namespaces. This turned upDan Gohman2008-05-13
| | | | | | | | 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
* Remove attribution from file headers, per discussion on llvmdev.Chris Lattner2007-12-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45418 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert r44626, which turned off the use of readonlyDuncan Sands2007-12-12
| | | | | | | | | | | and readnone for functions with bodies because it broke llvm-gcc-4.2 bootstrap. It turns out that, because of LLVM's array_ref hack, gcc was computing pure/const attributes wrong (now fixed by turning off the gcc ipa-pure-const pass). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44937 91177308-0d34-0410-b5e6-96231b3b80d8
* Commit 44487 broke bootstrap of llvm-gcc-4.2. It isDuncan Sands2007-12-05
| | | | | | | | not yet clear why, but in the meantime work around the problem by making less use of readnone/readonly info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@44626 91177308-0d34-0410-b5e6-96231b3b80d8
* Rather than having special rules like "intrinsics cannotDuncan Sands2007-12-03
| | | | | | | | | | 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-01
| | | | | | | | | | | | | | | | 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
* Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.Duncan Sands2007-11-01
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43620 91177308-0d34-0410-b5e6-96231b3b80d8
* Drop 'const'Devang Patel2007-05-03
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36662 91177308-0d34-0410-b5e6-96231b3b80d8
* Use 'static const char' instead of 'static const int'.Devang Patel2007-05-02
| | | | | | | | Due to darwin gcc bug, one version of darwin linker coalesces static const int, which defauts PassID based pass identification. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36652 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix build error.Lauro Ramos Venancio2007-05-02
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36648 91177308-0d34-0410-b5e6-96231b3b80d8
* Do not use typeinfo to identify pass in pass manager.Devang Patel2007-05-01
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36632 91177308-0d34-0410-b5e6-96231b3b80d8
* Removed unneeded <iostream> #include.Bill Wendling2006-11-17
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31810 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR780:Reid Spencer2006-06-07
| | | | | | | | | | | 1. Fix the macros in IncludeFile.h to put everything in the llvm namespace 2. Replace the previous explicit mechanism in all the .h and .cpp files with the macros in IncludeFile.h This gets us a consistent mechanism throughout LLVM for ensuring linkage. Next step is to make sure its used in enough places. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28715 91177308-0d34-0410-b5e6-96231b3b80d8
* For PR780:Reid Spencer2006-06-07
| | | | | | | | | | Break the "IncludeFile" mechanism into its own header file and adjust other files accordingly. Use this facility for the IntrinsicInst problem which was the subject of PR800. More to follow on this. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28709 91177308-0d34-0410-b5e6-96231b3b80d8
* Change from using a stub function to a stub variable for passing to theReid Spencer2006-06-01
| | | | | | | | IncludeFile hack to ensure linkage of analysis passes. This works around some -pedantic warnings about assigning an object to a function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28621 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove trailing whitespaceMisha Brukman2005-04-21
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21416 91177308-0d34-0410-b5e6-96231b3b80d8
* Make this more efficient by only making one virtual method call.Chris Lattner2005-03-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20793 91177308-0d34-0410-b5e6-96231b3b80d8
* Make this a bit more aggressiveChris Lattner2005-03-23
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20792 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix the missing symbols problem Bill was hitting. Patch contributed byChris Lattner2005-03-17
| | | | | | | Bill Wendling!! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20649 91177308-0d34-0410-b5e6-96231b3b80d8
* Adjust to new alias analysis interfacesChris Lattner2004-12-15
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18957 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly extern this.Chris Lattner2004-12-08
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18664 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix #includes of i*.h => Instructions.h as per PR403.Misha Brukman2004-07-29
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15334 91177308-0d34-0410-b5e6-96231b3b80d8
* Add #include <iostream> since Value.h does not #include it any more.Reid Spencer2004-07-04
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14622 91177308-0d34-0410-b5e6-96231b3b80d8
* Changes to work with the changes to the AliasAnalysis interface. The -no-aaChris Lattner2004-05-23
| | | | | | | class is now in the BasicAliasAnalysis.cpp file git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13684 91177308-0d34-0410-b5e6-96231b3b80d8
* Deinline some virtual methods, provide better mod/ref answers through theChris Lattner2004-03-15
| | | | | | | use of the boolean queries git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12410 91177308-0d34-0410-b5e6-96231b3b80d8
* Improve mod/ref information based on the pointsToConstantMemory method.Chris Lattner2004-01-30
| | | | git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11021 91177308-0d34-0410-b5e6-96231b3b80d8