summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/AliasAnalysis.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/AliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/AliasAnalysis.cpp96
1 files changed, 48 insertions, 48 deletions
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index d9a40b17a1f..dd2db1e5b27 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -119,7 +119,7 @@ bool AAResults::pointsToConstantMemory(const MemoryLocation &Loc,
}
ModRefInfo AAResults::getArgModRefInfo(ImmutableCallSite CS, unsigned ArgIdx) {
- ModRefInfo Result = MRI_ModRef;
+ ModRefInfo Result = ModRefInfo::ModRef;
for (const auto &AA : AAs) {
Result = intersectModRef(Result, AA->getArgModRefInfo(CS, ArgIdx));
@@ -138,8 +138,8 @@ ModRefInfo AAResults::getModRefInfo(Instruction *I, ImmutableCallSite Call) {
// Check if the two calls modify the same memory
return getModRefInfo(CS, Call);
} else if (I->isFenceLike()) {
- // If this is a fence, just return MRI_ModRef.
- return MRI_ModRef;
+ // If this is a fence, just return ModRef.
+ return ModRefInfo::ModRef;
} else {
// Otherwise, check if the call modifies or references the
// location this memory access defines. The best we can say
@@ -150,12 +150,12 @@ ModRefInfo AAResults::getModRefInfo(Instruction *I, ImmutableCallSite Call) {
if (isModOrRefSet(MR))
return setModAndRef(MR);
}
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
}
ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS,
const MemoryLocation &Loc) {
- ModRefInfo Result = MRI_ModRef;
+ ModRefInfo Result = ModRefInfo::ModRef;
for (const auto &AA : AAs) {
Result = intersectModRef(Result, AA->getModRefInfo(CS, Loc));
@@ -170,7 +170,7 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS,
auto MRB = getModRefBehavior(CS);
if (MRB == FMRB_DoesNotAccessMemory ||
MRB == FMRB_OnlyAccessesInaccessibleMem)
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
if (onlyReadsMemory(MRB))
Result = clearMod(Result);
@@ -179,7 +179,7 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS,
if (onlyAccessesArgPointees(MRB) || onlyAccessesInaccessibleOrArgMem(MRB)) {
bool DoesAlias = false;
- ModRefInfo AllArgsMask = MRI_NoModRef;
+ ModRefInfo AllArgsMask = ModRefInfo::NoModRef;
if (doesAccessArgPointees(MRB)) {
for (auto AI = CS.arg_begin(), AE = CS.arg_end(); AI != AE; ++AI) {
const Value *Arg = *AI;
@@ -195,9 +195,9 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS,
}
}
}
- // Return MRI_NoModRef if no alias found with any argument.
+ // Return NoModRef if no alias found with any argument.
if (!DoesAlias)
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
// Logical & between other AA analyses and argument analysis.
Result = intersectModRef(Result, AllArgsMask);
}
@@ -212,7 +212,7 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS,
ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS1,
ImmutableCallSite CS2) {
- ModRefInfo Result = MRI_ModRef;
+ ModRefInfo Result = ModRefInfo::ModRef;
for (const auto &AA : AAs) {
Result = intersectModRef(Result, AA->getModRefInfo(CS1, CS2));
@@ -228,15 +228,15 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS1,
// If CS1 or CS2 are readnone, they don't interact.
auto CS1B = getModRefBehavior(CS1);
if (CS1B == FMRB_DoesNotAccessMemory)
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
auto CS2B = getModRefBehavior(CS2);
if (CS2B == FMRB_DoesNotAccessMemory)
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
// If they both only read from memory, there is no dependence.
if (onlyReadsMemory(CS1B) && onlyReadsMemory(CS2B))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
// If CS1 only reads memory, the only dependence on CS2 can be
// from CS1 reading memory written by CS2.
@@ -249,7 +249,7 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS1,
// information from CS1's references to the memory referenced by
// CS2's arguments.
if (onlyAccessesArgPointees(CS2B)) {
- ModRefInfo R = MRI_NoModRef;
+ ModRefInfo R = ModRefInfo::NoModRef;
if (doesAccessArgPointees(CS2B)) {
for (auto I = CS2.arg_begin(), E = CS2.arg_end(); I != E; ++I) {
const Value *Arg = *I;
@@ -263,11 +263,11 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS1,
// - If CS2 modifies location, dependence exists if CS1 reads or writes.
// - If CS2 only reads location, dependence exists if CS1 writes.
ModRefInfo ArgModRefCS2 = getArgModRefInfo(CS2, CS2ArgIdx);
- ModRefInfo ArgMask = MRI_NoModRef;
+ ModRefInfo ArgMask = ModRefInfo::NoModRef;
if (isModSet(ArgModRefCS2))
- ArgMask = MRI_ModRef;
+ ArgMask = ModRefInfo::ModRef;
else if (isRefSet(ArgModRefCS2))
- ArgMask = MRI_Mod;
+ ArgMask = ModRefInfo::Mod;
// ModRefCS1 indicates what CS1 might do to CS2ArgLoc, and we use
// above ArgMask to update dependence info.
@@ -285,7 +285,7 @@ ModRefInfo AAResults::getModRefInfo(ImmutableCallSite CS1,
// If CS1 only accesses memory through arguments, check if CS2 references
// any of the memory referenced by CS1's arguments. If not, return NoModRef.
if (onlyAccessesArgPointees(CS1B)) {
- ModRefInfo R = MRI_NoModRef;
+ ModRefInfo R = ModRefInfo::NoModRef;
if (doesAccessArgPointees(CS1B)) {
for (auto I = CS1.arg_begin(), E = CS1.arg_end(); I != E; ++I) {
const Value *Arg = *I;
@@ -349,45 +349,45 @@ ModRefInfo AAResults::getModRefInfo(const LoadInst *L,
const MemoryLocation &Loc) {
// Be conservative in the face of atomic.
if (isStrongerThan(L->getOrdering(), AtomicOrdering::Unordered))
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
// If the load address doesn't alias the given address, it doesn't read
// or write the specified memory.
if (Loc.Ptr && !alias(MemoryLocation::get(L), Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
// Otherwise, a load just reads.
- return MRI_Ref;
+ return ModRefInfo::Ref;
}
ModRefInfo AAResults::getModRefInfo(const StoreInst *S,
const MemoryLocation &Loc) {
// Be conservative in the face of atomic.
if (isStrongerThan(S->getOrdering(), AtomicOrdering::Unordered))
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
if (Loc.Ptr) {
// If the store address cannot alias the pointer in question, then the
// specified memory cannot be modified by the store.
if (!alias(MemoryLocation::get(S), Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
// If the pointer is a pointer to constant memory, then it could not have
// been modified by this store.
if (pointsToConstantMemory(Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
}
// Otherwise, a store just writes.
- return MRI_Mod;
+ return ModRefInfo::Mod;
}
ModRefInfo AAResults::getModRefInfo(const FenceInst *S, const MemoryLocation &Loc) {
// If we know that the location is a constant memory location, the fence
// cannot modify this location.
if (Loc.Ptr && pointsToConstantMemory(Loc))
- return MRI_Ref;
- return MRI_ModRef;
+ return ModRefInfo::Ref;
+ return ModRefInfo::ModRef;
}
ModRefInfo AAResults::getModRefInfo(const VAArgInst *V,
@@ -396,16 +396,16 @@ ModRefInfo AAResults::getModRefInfo(const VAArgInst *V,
// If the va_arg address cannot alias the pointer in question, then the
// specified memory cannot be accessed by the va_arg.
if (!alias(MemoryLocation::get(V), Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
// If the pointer is a pointer to constant memory, then it could not have
// been modified by this va_arg.
if (pointsToConstantMemory(Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
}
// Otherwise, a va_arg reads and writes.
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
}
ModRefInfo AAResults::getModRefInfo(const CatchPadInst *CatchPad,
@@ -414,11 +414,11 @@ ModRefInfo AAResults::getModRefInfo(const CatchPadInst *CatchPad,
// If the pointer is a pointer to constant memory,
// then it could not have been modified by this catchpad.
if (pointsToConstantMemory(Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
}
// Otherwise, a catchpad reads and writes.
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
}
ModRefInfo AAResults::getModRefInfo(const CatchReturnInst *CatchRet,
@@ -427,37 +427,37 @@ ModRefInfo AAResults::getModRefInfo(const CatchReturnInst *CatchRet,
// If the pointer is a pointer to constant memory,
// then it could not have been modified by this catchpad.
if (pointsToConstantMemory(Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
}
// Otherwise, a catchret reads and writes.
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
}
ModRefInfo AAResults::getModRefInfo(const AtomicCmpXchgInst *CX,
const MemoryLocation &Loc) {
// Acquire/Release cmpxchg has properties that matter for arbitrary addresses.
if (isStrongerThanMonotonic(CX->getSuccessOrdering()))
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
// If the cmpxchg address does not alias the location, it does not access it.
if (Loc.Ptr && !alias(MemoryLocation::get(CX), Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
}
ModRefInfo AAResults::getModRefInfo(const AtomicRMWInst *RMW,
const MemoryLocation &Loc) {
// Acquire/Release atomicrmw has properties that matter for arbitrary addresses.
if (isStrongerThanMonotonic(RMW->getOrdering()))
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
// If the atomicrmw address does not alias the location, it does not access it.
if (Loc.Ptr && !alias(MemoryLocation::get(RMW), Loc))
- return MRI_NoModRef;
+ return ModRefInfo::NoModRef;
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
}
/// \brief Return information about whether a particular call site modifies
@@ -473,26 +473,26 @@ ModRefInfo AAResults::callCapturesBefore(const Instruction *I,
DominatorTree *DT,
OrderedBasicBlock *OBB) {
if (!DT)
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
const Value *Object =
GetUnderlyingObject(MemLoc.Ptr, I->getModule()->getDataLayout());
if (!isIdentifiedObject(Object) || isa<GlobalValue>(Object) ||
isa<Constant>(Object))
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
ImmutableCallSite CS(I);
if (!CS.getInstruction() || CS.getInstruction() == Object)
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
if (PointerMayBeCapturedBefore(Object, /* ReturnCaptures */ true,
/* StoreCaptures */ true, I, DT,
/* include Object */ true,
/* OrderedBasicBlock */ OBB))
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
unsigned ArgNo = 0;
- ModRefInfo R = MRI_NoModRef;
+ ModRefInfo R = ModRefInfo::NoModRef;
for (auto CI = CS.data_operands_begin(), CE = CS.data_operands_end();
CI != CE; ++CI, ++ArgNo) {
// Only look at the no-capture or byval pointer arguments. If this
@@ -512,10 +512,10 @@ ModRefInfo AAResults::callCapturesBefore(const Instruction *I,
if (CS.doesNotAccessMemory(ArgNo))
continue;
if (CS.onlyReadsMemory(ArgNo)) {
- R = MRI_Ref;
+ R = ModRefInfo::Ref;
continue;
}
- return MRI_ModRef;
+ return ModRefInfo::ModRef;
}
return R;
}
@@ -525,7 +525,7 @@ ModRefInfo AAResults::callCapturesBefore(const Instruction *I,
///
bool AAResults::canBasicBlockModify(const BasicBlock &BB,
const MemoryLocation &Loc) {
- return canInstructionRangeModRef(BB.front(), BB.back(), Loc, MRI_Mod);
+ return canInstructionRangeModRef(BB.front(), BB.back(), Loc, ModRefInfo::Mod);
}
/// canInstructionRangeModRef - Return true if it is possible for the
OpenPOWER on IntegriCloud