58 class AliasScopeNode {
59 const MDNode *Node =
nullptr;
62 AliasScopeNode() =
default;
63 explicit AliasScopeNode(
const MDNode *
N) : Node(N) {}
66 const MDNode *getNode()
const {
return Node; }
69 const MDNode *getDomain()
const {
72 return dyn_cast_or_null<MDNode>(Node->
getOperand(1));
89 if (!mayAliasInScopes(AScopes, BNoAlias))
92 if (!mayAliasInScopes(BScopes, ANoAlias))
109 if (!mayAliasInScopes(Call->
getMetadata(LLVMContext::MD_alias_scope),
122 if (!mayAliasInScopes(Call1->
getMetadata(LLVMContext::MD_alias_scope),
126 if (!mayAliasInScopes(Call2->
getMetadata(LLVMContext::MD_alias_scope),
136 if (
const MDNode *MD = dyn_cast<MDNode>(MDOp))
137 if (AliasScopeNode(MD).getDomain() == Domain)
141 bool ScopedNoAliasAAResult::mayAliasInScopes(
const MDNode *Scopes,
143 if (!Scopes || !NoAlias)
149 if (
const MDNode *NAMD = dyn_cast<MDNode>(MDOp))
150 if (
const MDNode *Domain = AliasScopeNode(NAMD).getDomain())
155 for (
const MDNode *Domain : Domains) {
158 if (ScopeNodes.
empty())
165 bool FoundAll =
true;
166 for (
const MDNode *SMD : ScopeNodes)
167 if (!NANodes.
count(SMD)) {
189 "Scoped NoAlias Alias Analysis",
false,
true)
Tracking metadata reference owned by Metadata.
The access neither references nor modifies the value stored in memory.
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
MDNode * Scope
The tag for alias scope specification (used with noalias).
This class represents lattice values for constants.
A Module instance is used to store all the information related to an LLVM module. ...
This class stores info we want to provide to or retain within an alias query.
This is the interface for a metadata-based scoped no-alias analysis.
The two locations do not alias at all.
INITIALIZE_PASS(ScopedNoAliasAAWrapperPass, "scoped-noalias", "Scoped NoAlias Alias Analysis", false, true) ImmutablePass *llvm
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
const MDOperand & getOperand(unsigned I) const
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI)
ImmutablePass * createScopedNoAliasAAWrapperPass()
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
A simple AA result which uses scoped-noalias metadata to answer queries.
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI)
op_range operands() const
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
void initializeScopedNoAliasAAWrapperPassPass(PassRegistry &)
ScopedNoAliasAAWrapperPass()
AliasResult
The possible results of an alias query.
Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
initializer< Ty > init(const Ty &Val)
LLVM_NODISCARD bool empty() const
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Represent the analysis usage information of a pass.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
Representation for a specific memory location.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
ImmutablePass class - This class is used to provide information that does not need to be run...
static void collectMDInDomain(const MDNode *List, const MDNode *Domain, SmallPtrSetImpl< const MDNode *> &Nodes)
MDNode * NoAlias
The tag specifying the noalias scope.
void setPreservesAll()
Set by analyses that do not transform their input at all.
bool doInitialization(Module &M) override
doInitialization - Virtual method overridden by subclasses to do any necessary initialization before ...
AAMDNodes AATags
The metadata nodes which describes the aliasing of the location (each member is null if that kind of ...
This file provides utility analysis objects describing memory locations.
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
static cl::opt< bool > EnableScopedNoAlias("enable-scoped-noalias", cl::init(true), cl::Hidden)
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
A container for analyses that lazily runs them and caches their results.
unsigned getNumOperands() const
Return number of MDNode operands.
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
A special type used by analysis passes to provide an address that identifies that particular analysis...
ScopedNoAliasAAResult run(Function &F, FunctionAnalysisManager &AM)