Add helper functions for computing the Location of load, store,
and vaarg instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118845 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp
index bb3ee46..95decec 100644
--- a/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -165,27 +165,20 @@
} else if (LoadInst *LI = dyn_cast<LoadInst>(I)) {
// Ignore non-volatile loads from local memory.
if (!LI->isVolatile()) {
- AliasAnalysis::Location Loc(LI->getPointerOperand(),
- AA->getTypeStoreSize(LI->getType()),
- LI->getMetadata(LLVMContext::MD_tbaa));
+ AliasAnalysis::Location Loc = AA->getLocation(LI);
if (AA->pointsToConstantMemory(Loc, /*OrLocal=*/true))
continue;
}
} else if (StoreInst *SI = dyn_cast<StoreInst>(I)) {
// Ignore non-volatile stores to local memory.
if (!SI->isVolatile()) {
- const Type *StoredType = SI->getValueOperand()->getType();
- AliasAnalysis::Location Loc(SI->getPointerOperand(),
- AA->getTypeStoreSize(StoredType),
- SI->getMetadata(LLVMContext::MD_tbaa));
+ AliasAnalysis::Location Loc = AA->getLocation(SI);
if (AA->pointsToConstantMemory(Loc, /*OrLocal=*/true))
continue;
}
} else if (VAArgInst *VI = dyn_cast<VAArgInst>(I)) {
// Ignore vaargs on local memory.
- AliasAnalysis::Location Loc(VI->getPointerOperand(),
- AliasAnalysis::UnknownSize,
- VI->getMetadata(LLVMContext::MD_tbaa));
+ AliasAnalysis::Location Loc = AA->getLocation(VI);
if (AA->pointsToConstantMemory(Loc, /*OrLocal=*/true))
continue;
}