mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
Modify ModRefInfo values using static inline method abstractions [NFC].
Summary: The aim is to make ModRefInfo checks and changes more intuitive and less error prone using inline methods that abstract the bit operations. Ideally ModRefInfo would become an enum class, but that change will require a wider set of changes into FunctionModRefBehavior. Reviewers: sanjoy, george.burgess.iv, dberlin, hfinkel Subscribers: nlopes, llvm-commits Differential Revision: https://reviews.llvm.org/D40749 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319821 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -212,32 +212,30 @@ MemDepResult MemoryDependenceResults::getCallSiteDependencyFrom(
|
||||
ModRefInfo MR = GetLocation(Inst, Loc, TLI);
|
||||
if (Loc.Ptr) {
|
||||
// A simple instruction.
|
||||
if (AA.getModRefInfo(CS, Loc) != MRI_NoModRef)
|
||||
if (isModOrRefSet(AA.getModRefInfo(CS, Loc)))
|
||||
return MemDepResult::getClobber(Inst);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (auto InstCS = CallSite(Inst)) {
|
||||
// If these two calls do not interfere, look past it.
|
||||
switch (AA.getModRefInfo(CS, InstCS)) {
|
||||
case MRI_NoModRef:
|
||||
if (isNoModRef(AA.getModRefInfo(CS, InstCS))) {
|
||||
// If the two calls are the same, return InstCS as a Def, so that
|
||||
// CS can be found redundant and eliminated.
|
||||
if (isReadOnlyCall && !(MR & MRI_Mod) &&
|
||||
if (isReadOnlyCall && !isModSet(MR) &&
|
||||
CS.getInstruction()->isIdenticalToWhenDefined(Inst))
|
||||
return MemDepResult::getDef(Inst);
|
||||
|
||||
// Otherwise if the two calls don't interact (e.g. InstCS is readnone)
|
||||
// keep scanning.
|
||||
continue;
|
||||
default:
|
||||
} else
|
||||
return MemDepResult::getClobber(Inst);
|
||||
}
|
||||
}
|
||||
|
||||
// If we could not obtain a pointer for the instruction and the instruction
|
||||
// touches memory then assume that this is a dependency.
|
||||
if (MR != MRI_NoModRef)
|
||||
if (isModOrRefSet(MR))
|
||||
return MemDepResult::getClobber(Inst);
|
||||
}
|
||||
|
||||
@@ -642,7 +640,7 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom(
|
||||
// If alias analysis can tell that this store is guaranteed to not modify
|
||||
// the query pointer, ignore it. Use getModRefInfo to handle cases where
|
||||
// the query pointer points to constant memory etc.
|
||||
if (AA.getModRefInfo(SI, MemLoc) == MRI_NoModRef)
|
||||
if (!isModOrRefSet(AA.getModRefInfo(SI, MemLoc)))
|
||||
continue;
|
||||
|
||||
// Ok, this store might clobber the query pointer. Check to see if it is
|
||||
@@ -688,7 +686,7 @@ MemDepResult MemoryDependenceResults::getSimplePointerDependencyFrom(
|
||||
// See if this instruction (e.g. a call or vaarg) mod/ref's the pointer.
|
||||
ModRefInfo MR = AA.getModRefInfo(Inst, MemLoc);
|
||||
// If necessary, perform additional analysis.
|
||||
if (MR == MRI_ModRef)
|
||||
if (isModAndRefSet(MR))
|
||||
MR = AA.callCapturesBefore(Inst, MemLoc, &DT, &OBB);
|
||||
switch (MR) {
|
||||
case MRI_NoModRef:
|
||||
|
||||
Reference in New Issue
Block a user