summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/MemoryLocation.cpp
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2019-01-07 05:42:51 +0000
committerChandler Carruth <chandlerc@gmail.com>2019-01-07 05:42:51 +0000
commit363ac6837427ffc6adcc68c44788bb4d92d52873 (patch)
tree1f5211bde4f720eed89db8e62ee16a4be663c2a8 /llvm/lib/Analysis/MemoryLocation.cpp
parentf6f134e4d44ca8db242e168de6da7eb68e9cf76e (diff)
downloadbcm5719-llvm-363ac6837427ffc6adcc68c44788bb4d92d52873.tar.gz
bcm5719-llvm-363ac6837427ffc6adcc68c44788bb4d92d52873.zip
[CallSite removal] Migrate all Alias Analysis APIs to use the newly
minted `CallBase` class instead of the `CallSite` wrapper. This moves the largest interwoven collection of APIs that traffic in `CallSite`s. While a handful of these could have been migrated with a minorly more shallow migration by converting from a `CallSite` to a `CallBase`, it hardly seemed worth it. Most of the APIs needed to migrate together because of the complex interplay of AA APIs and the fact that converting from a `CallBase` to a `CallSite` isn't free in its current implementation. Out of tree users of these APIs can fairly reliably migrate with some combination of `.getInstruction()` on the `CallSite` instance and casting the resulting pointer. The most generic form will look like `CS` -> `cast_or_null<CallBase>(CS.getInstruction())` but in most cases there is a more elegant migration. Hopefully, this migrates enough APIs for users to fully move from `CallSite` to the base class. All of the in-tree users were easily migrated in that fashion. Thanks for the review from Saleem! Differential Revision: https://reviews.llvm.org/D55641 llvm-svn: 350503
Diffstat (limited to 'llvm/lib/Analysis/MemoryLocation.cpp')
-rw-r--r--llvm/lib/Analysis/MemoryLocation.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/MemoryLocation.cpp b/llvm/lib/Analysis/MemoryLocation.cpp
index c15ed680e0a..27e8d72b8e8 100644
--- a/llvm/lib/Analysis/MemoryLocation.cpp
+++ b/llvm/lib/Analysis/MemoryLocation.cpp
@@ -125,15 +125,15 @@ MemoryLocation MemoryLocation::getForDest(const AnyMemIntrinsic *MI) {
return MemoryLocation(MI->getRawDest(), Size, AATags);
}
-MemoryLocation MemoryLocation::getForArgument(ImmutableCallSite CS,
+MemoryLocation MemoryLocation::getForArgument(const CallBase *Call,
unsigned ArgIdx,
const TargetLibraryInfo *TLI) {
AAMDNodes AATags;
- CS->getAAMetadata(AATags);
- const Value *Arg = CS.getArgument(ArgIdx);
+ Call->getAAMetadata(AATags);
+ const Value *Arg = Call->getArgOperand(ArgIdx);
// We may be able to produce an exact size for known intrinsics.
- if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(CS.getInstruction())) {
+ if (const IntrinsicInst *II = dyn_cast<IntrinsicInst>(Call)) {
const DataLayout &DL = II->getModule()->getDataLayout();
switch (II->getIntrinsicID()) {
@@ -193,19 +193,20 @@ MemoryLocation MemoryLocation::getForArgument(ImmutableCallSite CS,
// LoopIdiomRecognizer likes to turn loops into calls to memset_pattern16
// whenever possible.
LibFunc F;
- if (TLI && CS.getCalledFunction() &&
- TLI->getLibFunc(*CS.getCalledFunction(), F) &&
+ if (TLI && Call->getCalledFunction() &&
+ TLI->getLibFunc(*Call->getCalledFunction(), F) &&
F == LibFunc_memset_pattern16 && TLI->has(F)) {
assert((ArgIdx == 0 || ArgIdx == 1) &&
"Invalid argument index for memset_pattern16");
if (ArgIdx == 1)
return MemoryLocation(Arg, LocationSize::precise(16), AATags);
- if (const ConstantInt *LenCI = dyn_cast<ConstantInt>(CS.getArgument(2)))
+ if (const ConstantInt *LenCI =
+ dyn_cast<ConstantInt>(Call->getArgOperand(2)))
return MemoryLocation(Arg, LocationSize::precise(LenCI->getZExtValue()),
AATags);
}
// FIXME: Handle memset_pattern4 and memset_pattern8 also.
- return MemoryLocation(CS.getArgument(ArgIdx), LocationSize::unknown(),
+ return MemoryLocation(Call->getArgOperand(ArgIdx), LocationSize::unknown(),
AATags);
}
OpenPOWER on IntegriCloud