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));
88 if (!mayAliasInScopes(AScopes, BNoAlias))
91 if (!mayAliasInScopes(BScopes, ANoAlias))
133 if (
const MDNode *MD = dyn_cast<MDNode>(MDOp))
134 if (AliasScopeNode(MD).getDomain() == Domain)
138 bool ScopedNoAliasAAResult::mayAliasInScopes(
const MDNode *Scopes,
140 if (!Scopes || !NoAlias)
146 if (
const MDNode *NAMD = dyn_cast<MDNode>(MDOp))
147 if (
const MDNode *Domain = AliasScopeNode(NAMD).getDomain())
152 for (
const MDNode *Domain : Domains) {
155 if (ScopeNodes.
empty())
162 bool FoundAll =
true;
163 for (
const MDNode *SMD : ScopeNodes)
164 if (!NANodes.
count(SMD)) {
186 "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 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
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.
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 &)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
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.
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
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)
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc)
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.
A special type used by analysis passes to provide an address that identifies that particular analysis...
ScopedNoAliasAAResult run(Function &F, FunctionAnalysisManager &AM)