From 65316d674914067bd0b6da080f8a7cf7c1aa0e78 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Thu, 11 Nov 2010 21:50:19 +0000 Subject: Add helper functions for computing the Location of load, store, and vaarg instructions. llvm-svn: 118845 --- llvm/lib/Transforms/IPO/ArgumentPromotion.cpp | 5 +---- llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 13 +++---------- 2 files changed, 4 insertions(+), 14 deletions(-) (limited to 'llvm/lib/Transforms/IPO') 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(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(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(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; } -- cgit v1.2.3