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))
107 if (!mayAliasInScopes(
120 if (!mayAliasInScopes(
125 if (!mayAliasInScopes(
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).
Compute iterated dominance frontiers using a linear time algorithm.
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
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.
InstrTy * getInstruction() const
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.
Establish a view to a call site for examination.
ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc)
ModRefInfo getModRefInfo(ImmutableCallSite CS, 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)