diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -731,7 +731,7 @@ // global to be marked constant in some modules and non-constant in // others. GV may even be a declaration, not a definition. if (!GV->isConstant()) - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; continue; } @@ -747,18 +747,18 @@ if (const PHINode *PN = dyn_cast(V)) { // Don't bother inspecting phi nodes with many operands. if (PN->getNumIncomingValues() > MaxLookup) - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; append_range(Worklist, PN->incoming_values()); continue; } // Otherwise be conservative. - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; } while (!Worklist.empty() && --MaxLookup); // If we hit the maximum number of instructions to examine, be conservative. if (!Worklist.empty()) - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; return Result; } @@ -813,7 +813,7 @@ if (Call->paramHasAttr(ArgIdx, Attribute::ReadNone)) return ModRefInfo::NoModRef; - return AAResultBase::getArgModRefInfo(Call, ArgIdx); + return ModRefInfo::ModRef; } #ifndef NDEBUG @@ -972,8 +972,8 @@ if (isIntrinsicCall(Call, Intrinsic::invariant_start)) return ModRefInfo::Ref; - // The AAResultBase base class has some smarts, lets use them. - return AAResultBase::getModRefInfo(Call, Loc, AAQI); + // Be conservative. + return ModRefInfo::ModRef; } ModRefInfo BasicAAResult::getModRefInfo(const CallBase *Call1, @@ -1000,8 +1000,8 @@ ? ModRefInfo::Mod : ModRefInfo::NoModRef; - // The AAResultBase base class has some smarts, lets use them. - return AAResultBase::getModRefInfo(Call1, Call2, AAQI); + // Be conservative. + return ModRefInfo::ModRef; } /// Return true if we know V to the base address of the corresponding memory diff --git a/llvm/lib/Analysis/GlobalsModRef.cpp b/llvm/lib/Analysis/GlobalsModRef.cpp --- a/llvm/lib/Analysis/GlobalsModRef.cpp +++ b/llvm/lib/Analysis/GlobalsModRef.cpp @@ -241,7 +241,7 @@ if (FunctionInfo *FI = getFunctionInfo(F)) return MemoryEffects(FI->getModRefInfo()); - return AAResultBase::getMemoryEffects(F); + return MemoryEffects::unknown(); } /// Returns the function info for the function, or null if we don't have @@ -791,10 +791,7 @@ // FIXME: It would be good to handle other obvious no-alias cases here, but // it isn't clear how to do so reasonably without building a small version - // of BasicAA into this code. We could recurse into AAResultBase::alias - // here but that seems likely to go poorly as we're inside the - // implementation of such a query. Until then, just conservatively return - // false. + // of BasicAA into this code. return false; } while (!Inputs.empty()); @@ -892,7 +889,7 @@ if ((GV1 || GV2) && GV1 != GV2) return AliasResult::NoAlias; - return AAResultBase::alias(LocA, LocB, AAQI, nullptr); + return AliasResult::MayAlias; } ModRefInfo GlobalsAAResult::getModRefInfoForArgument(const CallBase *Call, diff --git a/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp b/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp --- a/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp +++ b/llvm/lib/Analysis/ObjCARCAliasAnalysis.cpp @@ -20,6 +20,11 @@ /// TODO: Theoretically we could check for dependencies between objc_* calls /// and FMRB_OnlyAccessesArgumentPointees calls or other well-behaved calls. /// +/// TODO: The calls here to AAResultBase member functions are all effectively +/// no-ops that just return a conservative result. The original intent was to +/// chain to another analysis for a recursive query, but this was lost in a +/// refactor. These should instead be rephrased in terms of queries to AAQI.AAR. +/// //===----------------------------------------------------------------------===// #include "llvm/Analysis/ObjCARCAliasAnalysis.h" diff --git a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp --- a/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp +++ b/llvm/lib/Analysis/ScalarEvolutionAliasAnalysis.cpp @@ -105,8 +105,7 @@ AAQI, nullptr) == AliasResult::NoAlias) return AliasResult::NoAlias; - // Forward the query to the next analysis. - return AAResultBase::alias(LocA, LocB, AAQI, nullptr); + return AliasResult::MayAlias; } /// Given an expression, try to find a base value. diff --git a/llvm/lib/Analysis/ScopedNoAliasAA.cpp b/llvm/lib/Analysis/ScopedNoAliasAA.cpp --- a/llvm/lib/Analysis/ScopedNoAliasAA.cpp +++ b/llvm/lib/Analysis/ScopedNoAliasAA.cpp @@ -56,7 +56,7 @@ AAQueryInfo &AAQI, const Instruction *) { if (!EnableScopedNoAlias) - return AAResultBase::alias(LocA, LocB, AAQI, nullptr); + return AliasResult::MayAlias; // Get the attached MDNodes. const MDNode *AScopes = LocA.AATags.Scope, *BScopes = LocB.AATags.Scope; @@ -69,15 +69,14 @@ if (!mayAliasInScopes(BScopes, ANoAlias)) return AliasResult::NoAlias; - // If they may alias, chain to the next AliasAnalysis. - return AAResultBase::alias(LocA, LocB, AAQI, nullptr); + return AliasResult::MayAlias; } ModRefInfo ScopedNoAliasAAResult::getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI) { if (!EnableScopedNoAlias) - return AAResultBase::getModRefInfo(Call, Loc, AAQI); + return ModRefInfo::ModRef; if (!mayAliasInScopes(Loc.AATags.Scope, Call->getMetadata(LLVMContext::MD_noalias))) @@ -87,14 +86,14 @@ Loc.AATags.NoAlias)) return ModRefInfo::NoModRef; - return AAResultBase::getModRefInfo(Call, Loc, AAQI); + return ModRefInfo::ModRef; } ModRefInfo ScopedNoAliasAAResult::getModRefInfo(const CallBase *Call1, const CallBase *Call2, AAQueryInfo &AAQI) { if (!EnableScopedNoAlias) - return AAResultBase::getModRefInfo(Call1, Call2, AAQI); + return ModRefInfo::ModRef; if (!mayAliasInScopes(Call1->getMetadata(LLVMContext::MD_alias_scope), Call2->getMetadata(LLVMContext::MD_noalias))) @@ -104,7 +103,7 @@ Call1->getMetadata(LLVMContext::MD_noalias))) return ModRefInfo::NoModRef; - return AAResultBase::getModRefInfo(Call1, Call2, AAQI); + return ModRefInfo::ModRef; } static void collectMDInDomain(const MDNode *List, const MDNode *Domain, diff --git a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp --- a/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp +++ b/llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp @@ -375,11 +375,10 @@ const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *) { if (!EnableTBAA) - return AAResultBase::alias(LocA, LocB, AAQI, nullptr); + return AliasResult::MayAlias; - // If accesses may alias, chain to the next AliasAnalysis. if (Aliases(LocA.AATags.TBAA, LocB.AATags.TBAA)) - return AAResultBase::alias(LocA, LocB, AAQI, nullptr); + return AliasResult::MayAlias; // Otherwise return a definitive result. return AliasResult::NoAlias; @@ -389,11 +388,11 @@ AAQueryInfo &AAQI, bool IgnoreLocals) { if (!EnableTBAA) - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; const MDNode *M = Loc.AATags.TBAA; if (!M) - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; // If this is an "immutable" type, we can assume the pointer is pointing // to constant memory. @@ -401,13 +400,13 @@ (isStructPathTBAA(M) && TBAAStructTagNode(M).isTypeImmutable())) return ModRefInfo::NoModRef; - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; } MemoryEffects TypeBasedAAResult::getMemoryEffects(const CallBase *Call, AAQueryInfo &AAQI) { if (!EnableTBAA) - return AAResultBase::getMemoryEffects(Call, AAQI); + return MemoryEffects::unknown(); // If this is an "immutable" type, the access is not observable. if (const MDNode *M = Call->getMetadata(LLVMContext::MD_tbaa)) @@ -415,40 +414,40 @@ (isStructPathTBAA(M) && TBAAStructTagNode(M).isTypeImmutable())) return MemoryEffects::none(); - return AAResultBase::getMemoryEffects(Call, AAQI); + return MemoryEffects::unknown(); } MemoryEffects TypeBasedAAResult::getMemoryEffects(const Function *F) { - // Functions don't have metadata. Just chain to the next implementation. - return AAResultBase::getMemoryEffects(F); + // Functions don't have metadata. + return MemoryEffects::unknown(); } ModRefInfo TypeBasedAAResult::getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI) { if (!EnableTBAA) - return AAResultBase::getModRefInfo(Call, Loc, AAQI); + return ModRefInfo::ModRef; if (const MDNode *L = Loc.AATags.TBAA) if (const MDNode *M = Call->getMetadata(LLVMContext::MD_tbaa)) if (!Aliases(L, M)) return ModRefInfo::NoModRef; - return AAResultBase::getModRefInfo(Call, Loc, AAQI); + return ModRefInfo::ModRef; } ModRefInfo TypeBasedAAResult::getModRefInfo(const CallBase *Call1, const CallBase *Call2, AAQueryInfo &AAQI) { if (!EnableTBAA) - return AAResultBase::getModRefInfo(Call1, Call2, AAQI); + return ModRefInfo::ModRef; if (const MDNode *M1 = Call1->getMetadata(LLVMContext::MD_tbaa)) if (const MDNode *M2 = Call2->getMetadata(LLVMContext::MD_tbaa)) if (!Aliases(M1, M2)) return ModRefInfo::NoModRef; - return AAResultBase::getModRefInfo(Call1, Call2, AAQI); + return ModRefInfo::ModRef; } bool MDNode::isTBAAVtableAccess() const { diff --git a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp --- a/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUAliasAnalysis.cpp @@ -93,8 +93,7 @@ } } - // Forward the query to the next alias analysis. - return AAResultBase::alias(LocA, LocB, AAQI, nullptr); + return AliasResult::MayAlias; } ModRefInfo AMDGPUAAResult::getModRefInfoMask(const MemoryLocation &Loc, @@ -111,5 +110,5 @@ AS == AMDGPUAS::CONSTANT_ADDRESS_32BIT) return ModRefInfo::NoModRef; - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; } diff --git a/llvm/lib/Target/NVPTX/NVPTXAliasAnalysis.cpp b/llvm/lib/Target/NVPTX/NVPTXAliasAnalysis.cpp --- a/llvm/lib/Target/NVPTX/NVPTXAliasAnalysis.cpp +++ b/llvm/lib/Target/NVPTX/NVPTXAliasAnalysis.cpp @@ -94,5 +94,5 @@ if (isConstOrParam(Base->getType()->getPointerAddressSpace())) return ModRefInfo::NoModRef; - return AAResultBase::getModRefInfoMask(Loc, AAQI, IgnoreLocals); + return ModRefInfo::ModRef; }