summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use correct size for address space in BasicAA.Matt Arsenault2013-11-161-2/+3
| | | | | | | | | | | | The tests just hit this with a different sized address space since I haven't figured out how to use this to break it. I thought I committed this a long time ago, and I'm not sure why missing this hasn't caused any problems. llvm-svn: 194903
* Revert r193251 : Use address-taken to disambiguate global variable and ↵Shuxin Yang2013-10-271-11/+0
| | | | | | indirect memops. llvm-svn: 193489
* Use address-taken to disambiguate global variable and indirect memops.Shuxin Yang2013-10-231-0/+11
| | | | | | | | | | Major steps include: 1). introduces a not-addr-taken bit-field in GlobalVariable 2). GlobalOpt pass sets "not-address-taken" if it proves a global varirable dosen't have its address taken. 3). AA use this info for disambiguation. llvm-svn: 193251
* Use type helper functionsMatt Arsenault2013-09-271-3/+2
| | | | llvm-svn: 191574
* Remove trailing spaces.Jakub Staszak2013-08-241-45/+44
| | | | llvm-svn: 189173
* Use SmallVectorImpl& instead of SmallVector to avoid repeating small vector ↵Craig Topper2013-07-141-2/+2
| | | | | | size. llvm-svn: 186274
* Make BasicAliasAnalysis recognize the fact a noalias argument cannot alias ↵Michael Kuperstein2013-05-281-4/+15
| | | | | | another argument, even if the other argument is not itself marked noalias. llvm-svn: 182755
* Revert r176408 and r176407 to address PR15540.Nadav Rotem2013-04-091-1/+30
| | | | llvm-svn: 179111
* BasicAA: Only query twice if the result of the more general query was MayAliasArnold Schwaighofer2013-03-261-5/+5
| | | | | | | | | | | | | | 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 llvm-svn: 178045
* add getUnderlyingObjectSize()Nuno Lopes2013-03-021-30/+1
| | | | | | | this is similar to getObjectSize(), but doesnt subtract the offset tweak the BasicAA code accordingly (per PR14988) llvm-svn: 176407
* Fix a problem in alias analysis. It is about the misinterpretation of "Object".Shuxin Yang2013-02-281-0/+29
| | | | | | | | | | | | | | | | | 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. llvm-svn: 176225
* Actually update the CMake and Makefile builds correctly, and update theChandler Carruth2013-01-021-1/+1
| | | | | | | | | | 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. llvm-svn: 171373
* Move all of the header files which are involved in modelling the LLVM IRChandler Carruth2013-01-021-10/+10
| | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 171366
* Optimistically analyse Phi cyclesArnold Schwaighofer2012-12-101-41/+13
| | | | | | | | | | 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. llvm-svn: 169788
* Use the new script to sort the includes of every file under lib.Chandler Carruth2012-12-031-9/+9
| | | | | | | | | | | | | | | | | 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. =] llvm-svn: 169131
* Phi speculation improvement for BasicAAHal Finkel2012-11-171-3/+12
| | | | | | | | | | | | 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. llvm-svn: 168245
* Don't infer whether a value is captured in the current function from theRichard Osborne2012-11-051-5/+5
| | | | | | | | | | '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. llvm-svn: 167381
* Apply the patch from PR14160. I failed to construct a testcase for this, butDuncan Sands2012-11-041-0/+3
| | | | | | I'm applying it anyway since it seems to be obviously correct. llvm-svn: 167370
* Revert the majority of the next patch in the address space series:Chandler Carruth2012-11-011-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 167222
* Resubmit the changes to llvm core to update the functions to support ↵Micah Villmow2012-10-151-3/+4
| | | | | | different pointer sizes on a per address space basis. llvm-svn: 165941
* Revert 165732 for further review.Micah Villmow2012-10-111-4/+3
| | | | llvm-svn: 165747
* Add in the first iteration of support for llvm/clang/lldb to allow variable ↵Micah Villmow2012-10-111-3/+4
| | | | | | per address space pointer sizes to be optimized correctly. llvm-svn: 165726
* Move TargetData to DataLayout.Micah Villmow2012-10-081-11/+11
| | | | llvm-svn: 165402
* GCC doesn't understand that OrigAliasResult having a value is correlated withDuncan Sands2012-09-191-1/+1
| | | | | | | ArePhisAssumedNoAlias, and warns that OrigAliasResult may be used uninitialized. Pacify GCC. llvm-svn: 164229
* BasicAA: Recognize cyclic NoAlias phisArnold Schwaighofer2012-09-061-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. llvm-svn: 163319
* BasicAA: GEPs of NoAlias'ing base ptr with equivalent indices are NoAliasArnold Schwaighofer2012-09-061-9/+65
| | | | | | | | | | | | 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. llvm-svn: 163317
* Switch BasicAliasAnalysis' cache to SmallDenseMap.Benjamin Kramer2012-09-051-9/+7
| | | | | | | | 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. llvm-svn: 163215
* Make MemoryBuiltins aware of TargetLibraryInfo.Benjamin Kramer2012-08-291-9/+11
| | | | | | | | | | | | | | | | 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. llvm-svn: 162841
* refactor the MemoryBuiltin analysis:Nuno Lopes2012-06-211-41/+4
| | | | | | | | | | | | - 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. llvm-svn: 158919
* Duncan pointed out that if the alignment isn't explicitly specified, it ↵Eli Friedman2012-02-271-4/+4
| | | | | | defaults to the ABI alignment. Given that, make this code a bit more aggressive in such cases. llvm-svn: 151584
* Teach BasicAA about the LLVM IR rules that allow reading past the end of an ↵Eli Friedman2012-02-271-9/+26
| | | | | | object given sufficient alignment. Fixes PR12098. llvm-svn: 151553
* Move isKnownNonNull from private implementation detail of BasicAA to a publicNick Lewycky2012-02-251-16/+0
| | | | | | function that others can use, next to llvm::isIdentifiedObject. llvm-svn: 151446
* Remove a comment about an alternative approach that wouldn'tDan Gohman2012-02-171-4/+1
| | | | | | | | actually work, at least as described. LLVM Metadata is not intended to suppress LLVM IR rules, as it can be stripped at any time. llvm-svn: 150821
* Refactor code to use new attribute getters on CallSite for NoCapture and ByVal.Nick Lewycky2011-11-201-2/+1
| | | | | | | | Suggested in code review by Eli. That code in InstCombine looks kinda suspicious. llvm-svn: 145013
* Remove the old atomic instrinsics. autoupgrade functionality is included ↵Eli Friedman2011-10-061-20/+0
| | | | | | with this patch. llvm-svn: 141333
* PR10628: Fix getModRefInfo so it queries the underlying alias() ↵Eli Friedman2011-09-281-1/+1
| | | | | | implementation correctly while checking nocapture calls. llvm-svn: 140666
* A couple minor corrections to r139276.Eli Friedman2011-09-081-14/+14
| | | | llvm-svn: 139277
* Fix the logic in BasicAliasAnalysis::aliasGEP for comparing GEP's with ↵Eli Friedman2011-09-081-33/+33
| | | | | | variable differences so that it actually does something sane. Fixes PR10881. llvm-svn: 139276
* memset_pattern16 uses a 16 BYTE pattern, not a 16 BIT pattern. Add comments ↵Owen Anderson2011-09-061-2/+4
| | | | | | to that effect. llvm-svn: 139205
* Teach BasicAA about the aliasing properties of memset_pattern16.Owen Anderson2011-09-061-1/+40
| | | | | | Fixes PR10872 and <rdar://problem/10065079>. llvm-svn: 139204
* Explicitly cast narrowing conversions inside {}s that will become errors inJeffrey Yasskin2011-07-271-1/+2
| | | | | | C++0x. llvm-svn: 136211
* land David Blaikie's patch to de-constify Type, with a few tweaks.Chris Lattner2011-07-181-2/+2
| | | | llvm-svn: 135375
* Initialize BasicAA's AliasCache to set it to use fewer buckets byDan Gohman2011-06-101-1/+7
| | | | | | | | 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. llvm-svn: 132862
* Reapply r131781, now that the GVN bug with partially-aliasing loadsDan Gohman2011-06-041-1/+11
| | | | | | is disabled. llvm-svn: 132632
* Revert r131781 again. Apparently there is more going on here.Dan Gohman2011-06-041-11/+1
| | | | llvm-svn: 132625
* Reapply r131781 (revert r131809), now that some BasicAA shortcomingsDan Gohman2011-06-041-1/+11
| | | | | | it exposed are fixed. llvm-svn: 132611
* Fix BasicAA's recursion detection so that it doesn't pessimizeDan Gohman2011-06-041-37/+27
| | | | | | | | | 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. llvm-svn: 132609
* When merging MustAlias and PartialAlias, chose PartialAlias insteadDan Gohman2011-06-031-10/+21
| | | | | | of conservatively choosing MayAlias. llvm-svn: 132579
* Make DecomposeGEPExpression check SimplifyInstruction onlyDan Gohman2011-05-241-9/+12
| | | | | | | | 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. llvm-svn: 131971
* fix a really nasty basicaa mod/ref calculation bug that was causing ↵Chris Lattner2011-05-231-2/+5
| | | | | | | | miscompilation of UnitTests/ObjC/messages-2.m with the recent optimizer improvements. llvm-svn: 131897
OpenPOWER on IntegriCloud