56 class AliasScopeNode {
60 AliasScopeNode() : Node(nullptr) {}
61 explicit AliasScopeNode(
const MDNode *
N) : Node(N) {}
64 const MDNode *getNode()
const {
return Node; }
67 const MDNode *getDomain()
const {
68 if (Node->getNumOperands() < 2)
70 return dyn_cast_or_null<MDNode>(Node->getOperand(1));
85 if (!mayAliasInScopes(AScopes, BNoAlias))
88 if (!mayAliasInScopes(BScopes, ANoAlias))
104 if (!mayAliasInScopes(
117 if (!mayAliasInScopes(
122 if (!mayAliasInScopes(
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)) {
185 "Scoped NoAlias Alias Analysis",
false,
true)
Tracking metadata reference owned by Metadata.
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).
A Module instance is used to store all the information related to an LLVM module. ...
size_type count(PtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
This is the interface for a metadata-based scoped no-alias analysis.
The two locations do not alias at all.
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...
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
A simple AA result which uses scoped-noalias metadata to answer queries.
INITIALIZE_PASS(ScopedNoAliasAAWrapperPass,"scoped-noalias","Scoped NoAlias Alias Analysis", false, true) ImmutablePass *llvm
static cl::opt< bool > EnableScopedNoAlias("enable-scoped-noalias", cl::init(true))
bool doFinalization(Module &M) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
void initializeScopedNoAliasAAWrapperPassPass(PassRegistry &)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
ScopedNoAliasAAWrapperPass()
The access neither references nor modifies the value stored in memory.
Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
initializer< Ty > init(const Ty &Val)
This file contains the declarations for the subclasses of Constant, which represent the different fla...
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
AliasResult
The possible results of an alias query.
Represent the analysis usage information of a pass.
LLVM_NODISCARD bool empty() const
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...
InstrTy * getInstruction() const
Module.h This file contains the declarations for the Module class.
MDNode * getMetadata(unsigned KindID) const
Get the metadata of given kind attached to this Instruction.
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 ...
ImmutableCallSite - establish a view to a call site for examination.
ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc)
op_range operands() const
ModRefInfo getModRefInfo(ImmutableCallSite CS, const MemoryLocation &Loc)
A container for analyses that lazily runs them and caches their results.
A special type used by analysis passes to provide an address that identifies that particular analysis...
ScopedNoAliasAAResult run(Function &F, FunctionAnalysisManager &AM)
static void collectMDInDomain(const MDNode *List, const MDNode *Domain, SmallPtrSetImpl< const MDNode * > &Nodes)