diff options
author | Philip Reames <listmail@philipreames.com> | 2018-09-07 21:36:11 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2018-09-07 21:36:11 +0000 |
commit | cb8b3278e5736e3a10bd2baa859e5b3118ed1612 (patch) | |
tree | 0c9999b8355f15c90f7bbc3b9fee91845863dc43 /llvm/lib/Analysis/MemoryLocation.cpp | |
parent | 06d02d0306c65f6eb5d77659af09c0cabd2cbd32 (diff) | |
download | bcm5719-llvm-cb8b3278e5736e3a10bd2baa859e5b3118ed1612.tar.gz bcm5719-llvm-cb8b3278e5736e3a10bd2baa859e5b3118ed1612.zip |
[AST] Generalize argument specific aliasing
AliasSetTracker has special case handling for memset, memcpy and memmove which pre-existed argmemonly on functions and readonly and writeonly on arguments. This patch generalizes it using the AA infrastructure to any call correctly annotated.
The motivation here is to cut down on confusion, not performance per se. For most instructions, there is a direct mapping to alias set. However, this is not guaranteed by the interface and was not in fact true for these three intrinsics *and only these three intrinsics*. I kept getting myself confused about this invariant, so I figured it would be good to clearly distinguish between a instructions and alias sets. Calls happened to be an easy target.
The nice side effect is that custom implementations of memset/memcpy/memmove - including wrappers discovered by IPO - can now be optimized the same as builts by LICM.
Note: The actual removal of the memset/memtransfer specific handling will happen in a follow on NFC patch. It was originally part of this one, but separate for ease of review and rebase.
Differential Revision: https://reviews.llvm.org/D50730
llvm-svn: 341713
Diffstat (limited to 'llvm/lib/Analysis/MemoryLocation.cpp')
-rw-r--r-- | llvm/lib/Analysis/MemoryLocation.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp index 43cebcd7a30..326944f2964 100644 --- a/llvm/lib/Analysis/MemoryLocation.cpp +++ b/llvm/lib/Analysis/MemoryLocation.cpp @@ -108,7 +108,7 @@ MemoryLocation MemoryLocation::getForDest(const AnyMemIntrinsic *MI) { MemoryLocation MemoryLocation::getForArgument(ImmutableCallSite CS, unsigned ArgIdx, - const TargetLibraryInfo &TLI) { + const TargetLibraryInfo *TLI) { AAMDNodes AATags; CS->getAAMetadata(AATags); const Value *Arg = CS.getArgument(ArgIdx); @@ -163,8 +163,9 @@ MemoryLocation MemoryLocation::getForArgument(ImmutableCallSite CS, // LoopIdiomRecognizer likes to turn loops into calls to memset_pattern16 // whenever possible. LibFunc F; - if (CS.getCalledFunction() && TLI.getLibFunc(*CS.getCalledFunction(), F) && - F == LibFunc_memset_pattern16 && TLI.has(F)) { + if (TLI && CS.getCalledFunction() && + TLI->getLibFunc(*CS.getCalledFunction(), F) && + F == LibFunc_memset_pattern16 && TLI->has(F)) { assert((ArgIdx == 0 || ArgIdx == 1) && "Invalid argument index for memset_pattern16"); if (ArgIdx == 1) |