summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/ArgumentPromotion.cpp5
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp13
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp7
-rw-r--r--llvm/lib/Transforms/Scalar/Sink.cpp6
4 files changed, 7 insertions, 24 deletions
diff --git a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
index fe30381170d..17ef703ad36 100644
--- a/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
+++ b/llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
@@ -433,10 +433,7 @@ bool ArgPromotion::isSafeToPromoteArgument(Argument *Arg, bool isByVal) const {
LoadInst *Load = Loads[i];
BasicBlock *BB = Load->getParent();
- AliasAnalysis::Location Loc(Load->getPointerOperand(),
- AA.getTypeStoreSize(Load->getType()),
- Load->getMetadata(LLVMContext::MD_tbaa));
-
+ AliasAnalysis::Location Loc = AA.getLocation(Load);
if (AA.canInstructionRangeModify(BB->front(), *Load, Loc))
return false; // Pointer is invalidated!
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index bb3ee465716..95decec0f87 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -165,27 +165,20 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
} 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;
}
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index e506d0efd7f..52791dd217d 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1351,11 +1351,8 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
SmallVectorImpl<Instruction*> &toErase) {
// Find the non-local dependencies of the load.
SmallVector<NonLocalDepResult, 64> Deps;
- AliasAnalysis::Location Loc(LI->getPointerOperand(),
- VN.getAliasAnalysis()->getTypeStoreSize(LI->getType()),
- LI->getMetadata(LLVMContext::MD_tbaa));
- MD->getNonLocalPointerDependency(Loc, true, LI->getParent(),
- Deps);
+ AliasAnalysis::Location Loc = VN.getAliasAnalysis()->getLocation(LI);
+ MD->getNonLocalPointerDependency(Loc, true, LI->getParent(), Deps);
//DEBUG(dbgs() << "INVESTIGATING NONLOCAL LOAD: "
// << Deps.size() << *LI << '\n');
diff --git a/llvm/lib/Transforms/Scalar/Sink.cpp b/llvm/lib/Transforms/Scalar/Sink.cpp
index a54ba8e0ae5..705f4420490 100644
--- a/llvm/lib/Transforms/Scalar/Sink.cpp
+++ b/llvm/lib/Transforms/Scalar/Sink.cpp
@@ -15,7 +15,6 @@
#define DEBUG_TYPE "sink"
#include "llvm/Transforms/Scalar.h"
#include "llvm/IntrinsicInst.h"
-#include "llvm/LLVMContext.h"
#include "llvm/Analysis/Dominators.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/AliasAnalysis.h"
@@ -157,10 +156,7 @@ static bool isSafeToMove(Instruction *Inst, AliasAnalysis *AA,
if (LoadInst *L = dyn_cast<LoadInst>(Inst)) {
if (L->isVolatile()) return false;
- Value *Ptr = L->getPointerOperand();
- uint64_t Size = AA->getTypeStoreSize(L->getType());
- const MDNode *TBAAInfo = L->getMetadata(LLVMContext::MD_tbaa);
- AliasAnalysis::Location Loc(Ptr, Size, TBAAInfo);
+ AliasAnalysis::Location Loc = AA->getLocation(L);
for (SmallPtrSet<Instruction *, 8>::iterator I = Stores.begin(),
E = Stores.end(); I != E; ++I)
if (AA->getModRefInfo(*I, Loc) & AliasAnalysis::Mod)
OpenPOWER on IntegriCloud