diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-04 22:56:29 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-04 22:56:29 +0000 |
commit | 3dcc91ee8c48f210d302937ecbbf0d277f8b656e (patch) | |
tree | 51a96163cfbba2cd870af97f498c96bd4776d518 /lib/Analysis/AliasAnalysisEvaluator.cpp | |
parent | abf7bdffd67689781a5104b13fa806b92f3e96e1 (diff) |
The two-callsite form of AliasAnalysis::getModRefInfo is documented
to return Ref if the left callsite only reads memory read or written
by the right callsite; fix BasicAliasAnalysis to implement this.
Add AliasAnalysisEvaluator support for testing the two-callsite
form of getModRefInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110270 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/AliasAnalysisEvaluator.cpp')
-rw-r--r-- | lib/Analysis/AliasAnalysisEvaluator.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp index 9ecdf57e31..a22f63acb1 100644 --- a/lib/Analysis/AliasAnalysisEvaluator.cpp +++ b/lib/Analysis/AliasAnalysisEvaluator.cpp @@ -107,6 +107,15 @@ PrintModRefResults(const char *Msg, bool P, Instruction *I, Value *Ptr, } } +static inline void +PrintModRefResults(const char *Msg, bool P, CallSite CSA, CallSite CSB, + Module *M) { + if (P) { + errs() << " " << Msg << ": " << *CSA.getInstruction() + << " <-> " << *CSB.getInstruction() << '\n'; + } +} + static inline bool isInterestingPointer(Value *V) { return V->getType()->isPointerTy() && !isa<ConstantPointerNull>(V); @@ -209,6 +218,29 @@ bool AAEval::runOnFunction(Function &F) { } } + // Mod/ref alias analysis: compare all pairs of calls + for (SetVector<CallSite>::iterator C = CallSites.begin(), + Ce = CallSites.end(); C != Ce; ++C) { + for (SetVector<CallSite>::iterator D = CallSites.begin(); D != Ce; ++D) { + if (D == C) + continue; + switch (AA.getModRefInfo(*C, *D)) { + case AliasAnalysis::NoModRef: + PrintModRefResults("NoModRef", PrintNoModRef, *C, *D, F.getParent()); + ++NoModRef; break; + case AliasAnalysis::Mod: + PrintModRefResults(" Mod", PrintMod, *C, *D, F.getParent()); + ++Mod; break; + case AliasAnalysis::Ref: + PrintModRefResults(" Ref", PrintRef, *C, *D, F.getParent()); + ++Ref; break; + case AliasAnalysis::ModRef: + PrintModRefResults(" ModRef", PrintModRef, *C, *D, F.getParent()); + ++ModRef; break; + } + } + } + return false; } |