ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx);
/// Return the behavior of the given call site.
- MemoryEffects getModRefBehavior(const CallBase *Call);
+ MemoryEffects getMemoryEffects(const CallBase *Call);
/// Return the behavior when calling the given function.
- MemoryEffects getModRefBehavior(const Function *F);
+ MemoryEffects getMemoryEffects(const Function *F);
/// Checks if the specified call is known to never read or write memory.
///
///
/// This property corresponds to the GCC 'const' attribute.
bool doesNotAccessMemory(const CallBase *Call) {
- return getModRefBehavior(Call).doesNotAccessMemory();
+ return getMemoryEffects(Call).doesNotAccessMemory();
}
/// Checks if the specified function is known to never read or write memory.
///
/// This property corresponds to the GCC 'const' attribute.
bool doesNotAccessMemory(const Function *F) {
- return getModRefBehavior(F).doesNotAccessMemory();
+ return getMemoryEffects(F).doesNotAccessMemory();
}
/// Checks if the specified call is known to only read from non-volatile
///
/// This property corresponds to the GCC 'pure' attribute.
bool onlyReadsMemory(const CallBase *Call) {
- return getModRefBehavior(Call).onlyReadsMemory();
+ return getMemoryEffects(Call).onlyReadsMemory();
}
/// Checks if the specified function is known to only read from non-volatile
///
/// This property corresponds to the GCC 'pure' attribute.
bool onlyReadsMemory(const Function *F) {
- return getModRefBehavior(F).onlyReadsMemory();
+ return getMemoryEffects(F).onlyReadsMemory();
}
/// getModRefInfo (for call sites) - Return information about whether
ModRefInfo callCapturesBefore(const Instruction *I,
const MemoryLocation &MemLoc, DominatorTree *DT,
AAQueryInfo &AAQIP);
- MemoryEffects getModRefBehavior(const CallBase *Call, AAQueryInfo &AAQI);
+ MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI);
private:
class Concept;
ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx) {
return AA.getArgModRefInfo(Call, ArgIdx);
}
- MemoryEffects getModRefBehavior(const CallBase *Call) {
- return AA.getModRefBehavior(Call, AAQI);
+ MemoryEffects getMemoryEffects(const CallBase *Call) {
+ return AA.getMemoryEffects(Call, AAQI);
}
bool isMustAlias(const MemoryLocation &LocA, const MemoryLocation &LocB) {
return alias(LocA, LocB) == AliasResult::MustAlias;
unsigned ArgIdx) = 0;
/// Return the behavior of the given call site.
- virtual MemoryEffects getModRefBehavior(const CallBase *Call,
- AAQueryInfo &AAQI) = 0;
+ virtual MemoryEffects getMemoryEffects(const CallBase *Call,
+ AAQueryInfo &AAQI) = 0;
/// Return the behavior when calling the given function.
- virtual MemoryEffects getModRefBehavior(const Function *F) = 0;
+ virtual MemoryEffects getMemoryEffects(const Function *F) = 0;
/// getModRefInfo (for call sites) - Return information about whether
/// a particular call site modifies or reads the specified memory location.
return Result.getArgModRefInfo(Call, ArgIdx);
}
- MemoryEffects getModRefBehavior(const CallBase *Call,
- AAQueryInfo &AAQI) override {
- return Result.getModRefBehavior(Call, AAQI);
+ MemoryEffects getMemoryEffects(const CallBase *Call,
+ AAQueryInfo &AAQI) override {
+ return Result.getMemoryEffects(Call, AAQI);
}
- MemoryEffects getModRefBehavior(const Function *F) override {
- return Result.getModRefBehavior(F);
+ MemoryEffects getMemoryEffects(const Function *F) override {
+ return Result.getMemoryEffects(F);
}
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
return ModRefInfo::ModRef;
}
- MemoryEffects getModRefBehavior(const CallBase *Call, AAQueryInfo &AAQI) {
+ MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI) {
return MemoryEffects::unknown();
}
- MemoryEffects getModRefBehavior(const Function *F) {
+ MemoryEffects getMemoryEffects(const Function *F) {
return MemoryEffects::unknown();
}
ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx);
/// Returns the behavior when calling the given call site.
- MemoryEffects getModRefBehavior(const CallBase *Call, AAQueryInfo &AAQI);
+ MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI);
/// Returns the behavior when calling the given function. For use when the
/// call site is not known.
- MemoryEffects getModRefBehavior(const Function *Fn);
+ MemoryEffects getMemoryEffects(const Function *Fn);
private:
struct DecomposedGEP;
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
AAQueryInfo &AAQI);
- using AAResultBase::getModRefBehavior;
- /// getModRefBehavior - Return the behavior of the specified function if
+ using AAResultBase::getMemoryEffects;
+ /// getMemoryEffects - Return the behavior of the specified function if
/// called from the specified call site. The call site may be null in which
/// case the most generic behavior of this function should be returned.
- MemoryEffects getModRefBehavior(const Function *F);
+ MemoryEffects getMemoryEffects(const Function *F);
private:
FunctionInfo *getFunctionInfo(const Function *F);
bool pointsToConstantMemory(const MemoryLocation &Loc, AAQueryInfo &AAQI,
bool OrLocal);
- using AAResultBase::getModRefBehavior;
- MemoryEffects getModRefBehavior(const Function *F);
+ using AAResultBase::getMemoryEffects;
+ MemoryEffects getMemoryEffects(const Function *F);
using AAResultBase::getModRefInfo;
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
AAQueryInfo &AAQI);
bool pointsToConstantMemory(const MemoryLocation &Loc, AAQueryInfo &AAQI,
bool OrLocal);
- MemoryEffects getModRefBehavior(const CallBase *Call, AAQueryInfo &AAQI);
- MemoryEffects getModRefBehavior(const Function *F);
+ MemoryEffects getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI);
+ MemoryEffects getMemoryEffects(const Function *F);
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc,
AAQueryInfo &AAQI);
ModRefInfo getModRefInfo(const CallBase *Call1, const CallBase *Call2,
// We can completely ignore inaccessible memory here, because MemoryLocations
// can only reference accessible memory.
- auto ME = getModRefBehavior(Call, AAQI)
+ auto ME = getMemoryEffects(Call, AAQI)
.getWithoutLoc(MemoryEffects::InaccessibleMem);
if (ME.doesNotAccessMemory())
return ModRefInfo::NoModRef;
// aggregate set of AA results.
// If Call1 or Call2 are readnone, they don't interact.
- auto Call1B = getModRefBehavior(Call1, AAQI);
+ auto Call1B = getMemoryEffects(Call1, AAQI);
if (Call1B.doesNotAccessMemory())
return ModRefInfo::NoModRef;
- auto Call2B = getModRefBehavior(Call2, AAQI);
+ auto Call2B = getMemoryEffects(Call2, AAQI);
if (Call2B.doesNotAccessMemory())
return ModRefInfo::NoModRef;
return Result;
}
-MemoryEffects AAResults::getModRefBehavior(const CallBase *Call,
- AAQueryInfo &AAQI) {
+MemoryEffects AAResults::getMemoryEffects(const CallBase *Call,
+ AAQueryInfo &AAQI) {
MemoryEffects Result = MemoryEffects::unknown();
for (const auto &AA : AAs) {
- Result &= AA->getModRefBehavior(Call, AAQI);
+ Result &= AA->getMemoryEffects(Call, AAQI);
// Early-exit the moment we reach the bottom of the lattice.
if (Result.doesNotAccessMemory())
return Result;
}
-MemoryEffects AAResults::getModRefBehavior(const CallBase *Call) {
+MemoryEffects AAResults::getMemoryEffects(const CallBase *Call) {
SimpleAAQueryInfo AAQI(*this);
- return getModRefBehavior(Call, AAQI);
+ return getMemoryEffects(Call, AAQI);
}
-MemoryEffects AAResults::getModRefBehavior(const Function *F) {
+MemoryEffects AAResults::getMemoryEffects(const Function *F) {
MemoryEffects Result = MemoryEffects::unknown();
for (const auto &AA : AAs) {
- Result &= AA->getModRefBehavior(F);
+ Result &= AA->getMemoryEffects(F);
// Early-exit the moment we reach the bottom of the lattice.
if (Result.doesNotAccessMemory())
AAQueryInfo &AAQIP) {
if (OptLoc == None) {
if (const auto *Call = dyn_cast<CallBase>(I))
- return getModRefBehavior(Call, AAQIP).getModRef();
+ return getMemoryEffects(Call, AAQIP).getModRef();
}
const MemoryLocation &Loc = OptLoc.value_or(MemoryLocation());
return AliasSet::NoAccess;
};
- ModRefInfo CallMask = AA.getModRefBehavior(Call).getModRef();
+ ModRefInfo CallMask = AA.getMemoryEffects(Call).getModRef();
// Some intrinsics are marked as modifying memory for control flow
// modelling purposes, but don't actually modify any specific memory
return II && II->getIntrinsicID() == IID;
}
-static MemoryEffects getModRefBehaviorFromAttrs(AttributeSet Attrs) {
+static MemoryEffects getMemoryEffectsFromAttrs(AttributeSet Attrs) {
if (Attrs.hasAttribute(Attribute::ReadNone))
return MemoryEffects::none();
}
/// Returns the behavior when calling the given call site.
-MemoryEffects BasicAAResult::getModRefBehavior(const CallBase *Call,
- AAQueryInfo &AAQI) {
+MemoryEffects BasicAAResult::getMemoryEffects(const CallBase *Call,
+ AAQueryInfo &AAQI) {
MemoryEffects Min =
- getModRefBehaviorFromAttrs(Call->getAttributes().getFnAttrs());
+ getMemoryEffectsFromAttrs(Call->getAttributes().getFnAttrs());
if (const Function *F = dyn_cast<Function>(Call->getCalledOperand())) {
- MemoryEffects FuncME = AAQI.AAR.getModRefBehavior(F);
+ MemoryEffects FuncME = AAQI.AAR.getMemoryEffects(F);
// Operand bundles on the call may also read or write memory, in addition
// to the behavior of the called function.
if (Call->hasReadingOperandBundles())
/// Returns the behavior when calling the given function. For use when the call
/// site is not known.
-MemoryEffects BasicAAResult::getModRefBehavior(const Function *F) {
+MemoryEffects BasicAAResult::getMemoryEffects(const Function *F) {
switch (F->getIntrinsicID()) {
case Intrinsic::experimental_guard:
case Intrinsic::experimental_deoptimize:
MemoryEffects::inaccessibleMemOnly(ModRefInfo::ModRef);
}
- return getModRefBehaviorFromAttrs(F->getAttributes().getFnAttrs());
+ return getMemoryEffectsFromAttrs(F->getAttributes().getFnAttrs());
}
/// Returns true if this is a writeonly (i.e Mod only) parameter.
// possibilities for guard intrinsics.
if (isIntrinsicCall(Call1, Intrinsic::experimental_guard))
- return isModSet(getModRefBehavior(Call2, AAQI).getModRef())
+ return isModSet(getMemoryEffects(Call2, AAQI).getModRef())
? ModRefInfo::Ref
: ModRefInfo::NoModRef;
if (isIntrinsicCall(Call2, Intrinsic::experimental_guard))
- return isModSet(getModRefBehavior(Call1, AAQI).getModRef())
+ return isModSet(getMemoryEffects(Call1, AAQI).getModRef())
? ModRefInfo::Mod
: ModRefInfo::NoModRef;
// This object is now destroyed!
}
-MemoryEffects GlobalsAAResult::getModRefBehavior(const Function *F) {
+MemoryEffects GlobalsAAResult::getMemoryEffects(const Function *F) {
if (FunctionInfo *FI = getFunctionInfo(F))
return MemoryEffects(FI->getModRefInfo());
- return AAResultBase::getModRefBehavior(F);
+ return AAResultBase::getMemoryEffects(F);
}
/// Returns the function info for the function, or null if we don't have
// Don't let dbg intrinsics affect alias info.
continue;
- MemoryEffects Behaviour = AAResultBase::getModRefBehavior(Callee);
+ MemoryEffects Behaviour = AAResultBase::getMemoryEffects(Callee);
FI.addModRefInfo(Behaviour.getModRef());
}
}
return false;
}
-MemoryEffects ObjCARCAAResult::getModRefBehavior(const Function *F) {
+MemoryEffects ObjCARCAAResult::getMemoryEffects(const Function *F) {
if (!EnableARCOpts)
- return AAResultBase::getModRefBehavior(F);
+ return AAResultBase::getMemoryEffects(F);
switch (GetFunctionClass(F)) {
case ARCInstKind::NoopCast:
break;
}
- return AAResultBase::getModRefBehavior(F);
+ return AAResultBase::getMemoryEffects(F);
}
ModRefInfo ObjCARCAAResult::getModRefInfo(const CallBase *Call,
return AAResultBase::pointsToConstantMemory(Loc, AAQI, OrLocal);
}
-MemoryEffects TypeBasedAAResult::getModRefBehavior(const CallBase *Call,
- AAQueryInfo &AAQI) {
+MemoryEffects TypeBasedAAResult::getMemoryEffects(const CallBase *Call,
+ AAQueryInfo &AAQI) {
if (!EnableTBAA)
- return AAResultBase::getModRefBehavior(Call, AAQI);
+ return AAResultBase::getMemoryEffects(Call, AAQI);
// If this is an "immutable" type, the access is not observable.
if (const MDNode *M = Call->getMetadata(LLVMContext::MD_tbaa))
(isStructPathTBAA(M) && TBAAStructTagNode(M).isTypeImmutable()))
return MemoryEffects::none();
- return AAResultBase::getModRefBehavior(Call, AAQI);
+ return AAResultBase::getMemoryEffects(Call, AAQI);
}
-MemoryEffects TypeBasedAAResult::getModRefBehavior(const Function *F) {
+MemoryEffects TypeBasedAAResult::getMemoryEffects(const Function *F) {
// Functions don't have metadata. Just chain to the next implementation.
- return AAResultBase::getModRefBehavior(F);
+ return AAResultBase::getMemoryEffects(F);
}
ModRefInfo TypeBasedAAResult::getModRefInfo(const CallBase *Call,
static MemoryEffects checkFunctionMemoryAccess(Function &F, bool ThisBody,
AAResults &AAR,
const SCCNodeSet &SCCNodes) {
- MemoryEffects OrigME = AAR.getModRefBehavior(&F);
+ MemoryEffects OrigME = AAR.getMemoryEffects(&F);
if (OrigME.doesNotAccessMemory())
// Already perfect!
return OrigME;
if (!Call->hasOperandBundles() && Call->getCalledFunction() &&
SCCNodes.count(Call->getCalledFunction()))
continue;
- MemoryEffects CallME = AAR.getModRefBehavior(Call);
+ MemoryEffects CallME = AAR.getMemoryEffects(Call);
// If the call doesn't access memory, we're done.
if (CallME.doesNotAccessMemory())
const auto *Call = cast<CallBase>(Inst);
// See if AliasAnalysis can help us with the call.
- MemoryEffects ME = PA.getAA()->getModRefBehavior(Call);
+ MemoryEffects ME = PA.getAA()->getMemoryEffects(Call);
if (ME.onlyReadsMemory())
return false;
if (ME.onlyAccessesArgPointees()) {
return true;
// Handle simple cases by querying alias analysis.
- MemoryEffects Behavior = AA->getModRefBehavior(CI);
+ MemoryEffects Behavior = AA->getMemoryEffects(CI);
if (Behavior.doesNotAccessMemory())
return true;
if (Behavior.onlyReadsMemory()) {
IsFuncCall = true;
if (CalleeAAR) {
- MemoryEffects ME = CalleeAAR->getModRefBehavior(Call);
+ MemoryEffects ME = CalleeAAR->getMemoryEffects(Call);
// We'll retain this knowledge without additional metadata.
if (ME.onlyAccessesInaccessibleMem())
auto AAR = GlobalsAAResult::analyzeModule(*M, GetTLI, CG);
- EXPECT_EQ(MemoryEffects::unknown(), AAR.getModRefBehavior(&F1));
- EXPECT_EQ(MemoryEffects::none(), AAR.getModRefBehavior(&F2));
- EXPECT_EQ(MemoryEffects::readOnly(), AAR.getModRefBehavior(&F3));
+ EXPECT_EQ(MemoryEffects::unknown(), AAR.getMemoryEffects(&F1));
+ EXPECT_EQ(MemoryEffects::none(), AAR.getMemoryEffects(&F2));
+ EXPECT_EQ(MemoryEffects::readOnly(), AAR.getMemoryEffects(&F3));
}
auto *AF = SE.getConstant(IntegerType::getInt64Ty(CI->getContext()), 0);
auto *CalledFunction = CI->getCalledFunction();
- MemoryEffects ME = AA.getModRefBehavior(CalledFunction);
+ MemoryEffects ME = AA.getMemoryEffects(CalledFunction);
if (ME.doesNotAccessMemory())
return true;
}
if (AllowModrefCall) {
- MemoryEffects ME = AA.getModRefBehavior(CalledFunction);
+ MemoryEffects ME = AA.getMemoryEffects(CalledFunction);
if (ME.onlyAccessesArgPointees()) {
for (const auto &Arg : CI.args()) {
if (!Arg->getType()->isPointerTy())