diff options
author | Dan Gohman <gohman@apple.com> | 2010-11-11 21:50:19 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-11-11 21:50:19 +0000 |
commit | 6d8eb156e6be727570b300bac7712f745a318c7d (patch) | |
tree | cd4250cc4395e8077f2dac80017fbe44ae96a94b /lib/Analysis/MemoryDependenceAnalysis.cpp | |
parent | ef5b390263ebe6e22c89cb16faebf0fb3c4ce1ee (diff) | |
download | external_llvm-6d8eb156e6be727570b300bac7712f745a318c7d.zip external_llvm-6d8eb156e6be727570b300bac7712f745a318c7d.tar.gz external_llvm-6d8eb156e6be727570b300bac7712f745a318c7d.tar.bz2 |
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
Diffstat (limited to 'lib/Analysis/MemoryDependenceAnalysis.cpp')
-rw-r--r-- | lib/Analysis/MemoryDependenceAnalysis.cpp | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/lib/Analysis/MemoryDependenceAnalysis.cpp b/lib/Analysis/MemoryDependenceAnalysis.cpp index 96af281..a16e334 100644 --- a/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -115,9 +115,7 @@ AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst, Loc = AliasAnalysis::Location(); return AliasAnalysis::ModRef; } - Loc = AliasAnalysis::Location(LI->getPointerOperand(), - AA->getTypeStoreSize(LI->getType()), - LI->getMetadata(LLVMContext::MD_tbaa)); + Loc = AA->getLocation(LI); return AliasAnalysis::Ref; } @@ -126,17 +124,12 @@ AliasAnalysis::ModRefResult GetLocation(const Instruction *Inst, Loc = AliasAnalysis::Location(); return AliasAnalysis::ModRef; } - Loc = AliasAnalysis::Location(SI->getPointerOperand(), - AA->getTypeStoreSize(SI->getValueOperand() - ->getType()), - SI->getMetadata(LLVMContext::MD_tbaa)); + Loc = AA->getLocation(SI); return AliasAnalysis::Mod; } if (const VAArgInst *V = dyn_cast<VAArgInst>(Inst)) { - Loc = AliasAnalysis::Location(V->getPointerOperand(), - AA->getTypeStoreSize(V->getType()), - V->getMetadata(LLVMContext::MD_tbaa)); + Loc = AA->getLocation(V); return AliasAnalysis::ModRef; } @@ -288,10 +281,7 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad, // Values depend on loads if the pointers are must aliased. This means that // a load depends on another must aliased load from the same value. if (LoadInst *LI = dyn_cast<LoadInst>(Inst)) { - Value *Pointer = LI->getPointerOperand(); - uint64_t PointerSize = AA->getTypeStoreSize(LI->getType()); - MDNode *TBAATag = LI->getMetadata(LLVMContext::MD_tbaa); - AliasAnalysis::Location LoadLoc(Pointer, PointerSize, TBAATag); + AliasAnalysis::Location LoadLoc = AA->getLocation(LI); // If we found a pointer, check if it could be the same as our pointer. AliasAnalysis::AliasResult R = AA->alias(LoadLoc, MemLoc); @@ -324,14 +314,10 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad, // Ok, this store might clobber the query pointer. Check to see if it is // a must alias: in this case, we want to return this as a def. - Value *Pointer = SI->getPointerOperand(); - uint64_t PointerSize = AA->getTypeStoreSize(SI->getOperand(0)->getType()); - MDNode *TBAATag = SI->getMetadata(LLVMContext::MD_tbaa); + AliasAnalysis::Location StoreLoc = AA->getLocation(SI); // If we found a pointer, check if it could be the same as our pointer. - AliasAnalysis::AliasResult R = - AA->alias(AliasAnalysis::Location(Pointer, PointerSize, TBAATag), - MemLoc); + AliasAnalysis::AliasResult R = AA->alias(StoreLoc, MemLoc); if (R == AliasAnalysis::NoAlias) continue; |