mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-25 05:22:04 +00:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user