diff options
author | Dan Gohman <gohman@apple.com> | 2009-07-25 00:48:42 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-07-25 00:48:42 +0000 |
commit | fc2a3ed0c9e32cf7edaf5030fa0972b916cc5f0b (patch) | |
tree | 9fe2f2a8710310b2c62877dd3dec1b60ae471bf8 /lib/Analysis/AliasAnalysisEvaluator.cpp | |
parent | d5b385c09f134ccd5f9ed6f7b6b7a9f3410c6d44 (diff) |
Make AliasAnalysis and related classes use
getAnalysisIfAvailable<TargetData>().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AliasAnalysisEvaluator.cpp')
-rw-r--r-- | lib/Analysis/AliasAnalysisEvaluator.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index d4ae73cee8..942bc4b1eb 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -109,8 +109,6 @@ PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, bool AAEval::runOnFunction(Function &F) { AliasAnalysis &AA = getAnalysis<AliasAnalysis>(); - const TargetData &TD = AA.getTargetData(); - std::set<Value *> Pointers; std::set<CallSite> CallSites; @@ -142,14 +140,14 @@ bool AAEval::runOnFunction(Function &F) { // iterate over the worklist, and run the full (n^2)/2 disambiguations for (std::set<Value *>::iterator I1 = Pointers.begin(), E = Pointers.end(); I1 != E; ++I1) { - unsigned I1Size = 0; + unsigned I1Size = ~0u; const Type *I1ElTy = cast<PointerType>((*I1)->getType())->getElementType(); - if (I1ElTy->isSized()) I1Size = TD.getTypeStoreSize(I1ElTy); + if (I1ElTy->isSized()) I1Size = AA.getTypeStoreSize(I1ElTy); for (std::set<Value *>::iterator I2 = Pointers.begin(); I2 != I1; ++I2) { - unsigned I2Size = 0; + unsigned I2Size = ~0u; const Type *I2ElTy =cast<PointerType>((*I2)->getType())->getElementType(); - if (I2ElTy->isSized()) I2Size = TD.getTypeStoreSize(I2ElTy); + if (I2ElTy->isSized()) I2Size = AA.getTypeStoreSize(I2ElTy); switch (AA.alias(*I1, I1Size, *I2, I2Size)) { case AliasAnalysis::NoAlias: @@ -174,9 +172,9 @@ bool AAEval::runOnFunction(Function &F) { for (std::set<Value *>::iterator V = Pointers.begin(), Ve = Pointers.end(); V != Ve; ++V) { - unsigned Size = 0; + unsigned Size = ~0u; const Type *ElTy = cast<PointerType>((*V)->getType())->getElementType(); - if (ElTy->isSized()) Size = TD.getTypeStoreSize(ElTy); + if (ElTy->isSized()) Size = AA.getTypeStoreSize(ElTy); switch (AA.getModRefInfo(*C, *V, Size)) { case AliasAnalysis::NoModRef: |