65 : TLI(
Arg.TLI), AAs(
std::move(
Arg.AAs)), AADeps(
std::move(
Arg.AADeps)) {
67 AA->setAAResults(
this);
77 AA->setAAResults(
nullptr);
88 if (!PAC.preservedWhenStateless())
108 return alias(LocA, LocB, AAQIP);
113 for (
const auto &AA : AAs) {
114 auto Result = AA->alias(LocA, LocB, AAQI);
129 for (
const auto &AA : AAs)
130 if (AA->pointsToConstantMemory(Loc, AAQI, OrLocal))
139 for (
const auto &AA : AAs) {
158 if (
const auto *Call1 = dyn_cast<CallBase>(I)) {
188 for (
const auto &AA : AAs) {
209 bool IsMustAlias =
true;
216 unsigned ArgIdx = std::distance(Call->
arg_begin(), AI);
255 for (
const auto &AA : AAs) {
256 Result =
intersectModRef(Result, AA->getModRefInfo(Call1, Call2, AAQI));
293 bool IsMustAlias =
true;
298 unsigned Call2ArgIdx = std::distance(Call2->
arg_begin(),
I);
344 bool IsMustAlias =
true;
349 unsigned Call1ArgIdx = std::distance(Call1->
arg_begin(),
I);
386 for (
const auto &AA : AAs) {
400 for (
const auto &AA : AAs) {
423 OS <<
"PartialAlias";
647 const Value *Object =
650 isa<Constant>(Object))
654 if (!Call || Call == Object)
665 bool IsMustAlias =
true;
668 CI != CE; ++CI, ++ArgNo) {
672 if (!(*CI)->getType()->isPointerTy() ||
716 "Instructions not in same basic block!");
764 "Function Alias Analysis Results",
false,
true)
797 new AAResults(getAnalysis<TargetLibraryInfoWrapperPass>().getTLI(F)));
804 AAR->addAAResult(getAnalysis<BasicAAWrapperPass>().getResult());
807 if (
auto *WrapperPass = getAnalysisIfAvailable<ScopedNoAliasAAWrapperPass>())
808 AAR->addAAResult(WrapperPass->getResult());
809 if (
auto *WrapperPass = getAnalysisIfAvailable<TypeBasedAAWrapperPass>())
810 AAR->addAAResult(WrapperPass->getResult());
811 if (
auto *WrapperPass =
812 getAnalysisIfAvailable<objcarc::ObjCARCAAWrapperPass>())
813 AAR->addAAResult(WrapperPass->getResult());
814 if (
auto *WrapperPass = getAnalysisIfAvailable<GlobalsAAWrapperPass>())
815 AAR->addAAResult(WrapperPass->getResult());
816 if (
auto *WrapperPass = getAnalysisIfAvailable<SCEVAAWrapperPass>())
817 AAR->addAAResult(WrapperPass->getResult());
818 if (
auto *WrapperPass = getAnalysisIfAvailable<CFLAndersAAWrapperPass>())
819 AAR->addAAResult(WrapperPass->getResult());
820 if (
auto *WrapperPass = getAnalysisIfAvailable<CFLSteensAAWrapperPass>())
821 AAR->addAAResult(WrapperPass->getResult());
825 if (
auto *WrapperPass = getAnalysisIfAvailable<ExternalAAWrapperPass>())
827 WrapperPass->CB(*
this, F, *AAR);
858 AAR.addAAResult(BAR);
861 if (
auto *WrapperPass =
863 AAR.addAAResult(WrapperPass->getResult());
865 AAR.addAAResult(WrapperPass->getResult());
866 if (
auto *WrapperPass =
868 AAR.addAAResult(WrapperPass->getResult());
870 AAR.addAAResult(WrapperPass->getResult());
872 AAR.addAAResult(WrapperPass->getResult());
874 AAR.addAAResult(WrapperPass->getResult());
877 WrapperPass->CB(P, F, AAR);
883 if (
const auto *Call = dyn_cast<CallBase>(V))
889 if (
const Argument *A = dyn_cast<Argument>(V))
890 return A->hasNoAliasAttr();
895 if (isa<AllocaInst>(V))
897 if (isa<GlobalValue>(V) && !isa<GlobalAlias>(V))
901 if (
const Argument *A = dyn_cast<Argument>(V))
902 return A->hasNoAliasAttr() || A->hasByValAttr();
Legacy wrapper pass to provide the GlobalsAAResult object.
The access may reference and may modify the value stored in memory.
Pass interface - Implemented by all 'passes'.
LLVM_NODISCARD ModRefInfo unionModRef(const ModRefInfo MRI1, const ModRefInfo MRI2)
User::op_iterator data_operands_end()
bool invalidate(IRUnitT &IR, const PreservedAnalyses &PA)
Trigger the invalidation of some other analysis pass if not already handled and return whether it was...
The access neither references nor modifies the value stored in memory.
LLVM_NODISCARD ModRefInfo clearMust(const ModRefInfo MRI)
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
This class represents an incoming formal argument to a Function.
bool doesNotAccessMemory(unsigned OpNo) const
Atomic ordering constants.
bool isFenceLike() const
Return true if this instruction behaves like a memory fence: it can load or store to memory location ...
This is the interface for LLVM's inclusion-based alias analysis implemented with CFL graph reachabili...
This class represents lattice values for constants.
This is the interface for a simple mod/ref and alias analysis over globals.
An instruction for ordering other memory operations.
An instruction that atomically checks whether a specified value is in a memory location, and, if it is, stores a new value there.
std::function< void(Pass &, Function &, AAResults &)> CallbackT
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(ExternalAAWrapperPass, "external-aa", "External Alias Analysis", false, true) ImmutablePass *llvm
AtomicOrdering getOrdering() const
Returns the ordering constraint of this load instruction.
Function Alias Analysis Results
This is the AA result object for the basic, local, and stateless alias analysis.
static bool onlyAccessesInaccessibleOrArgMem(FunctionModRefBehavior MRB)
Checks if functions with the specified behavior are known to read and write at most from memory that ...
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
bool isNoAliasCall(const Value *V)
Return true if this pointer is returned by a noalias function.
block Block Frequency true
An instruction for reading from memory.
an instruction that atomically reads a memory location, combines it with another value, and then stores the result back.
User::op_iterator data_operands_begin()
data_operands_begin/data_operands_end - Return iterators iterating over the call / invoke argument li...
void initializeExternalAAWrapperPassPass(PassRegistry &)
This indicates that the function could not be classified into one of the behaviors above...
Legacy wrapper pass to provide the TypeBasedAAResult object.
PreservedAnalysisChecker getChecker() const
Build a checker for this PreservedAnalyses and the specified analysis type.
LLVM_NODISCARD ModRefInfo clearMod(const ModRefInfo MRI)
AliasResult alias(const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
bool doesNotCapture(unsigned OpNo) const
Determine whether this data operand is not captured.
AnalysisUsage & addRequired()
The only memory references in this function (if it has any) are references of memory that is otherwis...
#define INITIALIZE_PASS_DEPENDENCY(depName)
This is the interface for a SCEV-based alias analysis.
FunctionPass * createAAResultsWrapperPass()
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
static bool doesNotReadMemory(FunctionModRefBehavior MRB)
Checks if functions with the specified behavior are known to only write memory (or not access memory ...
bool isStrongerThan(AtomicOrdering ao, AtomicOrdering other)
Returns true if ao is stronger than other as defined by the AtomicOrdering lattice, which is based on C++'s definition.
LLVM_NODISCARD ModRefInfo clearRef(const ModRefInfo MRI)
The access may reference the value stored in memory, a mustAlias relation was found, and no mayAlias or partialAlias found.
The access may reference the value stored in memory.
This file contains the simple types necessary to represent the attributes associated with functions a...
static MemoryLocation getForArgument(const CallBase *Call, unsigned ArgIdx, const TargetLibraryInfo *TLI)
Return a location representing a particular argument of a call.
AAResults createLegacyPMAAResults(Pass &P, Function &F, BasicAAResult &BAR)
A helper for the legacy pass manager to create a AAResults object populated to the best of our abilit...
bool isIdentifiedObject(const Value *V)
Return true if this pointer refers to a distinct and identifiable object.
void initializeAAResultsWrapperPassPass(PassRegistry &)
FunctionModRefBehavior getModRefBehavior(const CallBase *Call)
Return the behavior of the given call site.
LLVM_NODISCARD bool isMustSet(const ModRefInfo MRI)
Type * getType() const
All values are typed, get the type of this value.
AtomicOrdering getSuccessOrdering() const
Returns the success ordering constraint of this cmpxchg instruction.
The access may reference, modify or both the value stored in memory, a mustAlias relation was found...
FunctionModRefBehavior
Summary of how a function affects memory in the program.
The access may modify the value stored in memory, a mustAlias relation was found, and no mayAlias or ...
bool runOnFunction(Function &F) override
Run the wrapper pass to rebuild an aggregation over known AA passes.
Legacy wrapper pass to provide the CFLSteensAAResult object.
An instruction for storing to memory.
AnalysisType & getAnalysis() const
getAnalysis<AnalysisType>() - This function is used by subclasses to get to the analysis information ...
bool PointerMayBeCapturedBefore(const Value *V, bool ReturnCaptures, bool StoreCaptures, const Instruction *I, const DominatorTree *DT, bool IncludeI=false, OrderedBasicBlock *OBB=nullptr, unsigned MaxUsesToExplore=DefaultMaxUsesToExplore)
PointerMayBeCapturedBefore - Return true if this pointer value may be captured by the enclosing funct...
static cl::opt< bool > DisableBasicAA("disable-basicaa", cl::Hidden, cl::init(false))
Allow disabling BasicAA from the AA results.
bool isStrongerThanMonotonic(AtomicOrdering ao)
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
AliasResult
The possible results of an alias query.
bool invalidate(Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation events in the new pass manager.
bool pointsToConstantMemory(const MemoryLocation &Loc, bool OrLocal=false)
Checks whether the given location points to constant memory, or if OrLocal is true whether it points ...
ImmutablePass * createExternalAAWrapperPass(std::function< void(Pass &, Function &, AAResults &)> Callback)
A wrapper pass around a callback which can be used to populate the AAResults in the AAResultsWrapperP...
Legacy wrapper pass to provide the ScopedNoAliasAAResult object.
static MemoryLocation get(const LoadInst *LI)
Return a location with information about the memory reference by the given instruction.
This is the interface for LLVM's unification-based alias analysis implemented with CFL graph reachabi...
initializer< Ty > init(const Ty &Val)
LLVM_NODISCARD ModRefInfo setMust(const ModRefInfo MRI)
A set of analyses that are preserved following a run of a transformation pass.
This is the interface for a metadata-based TBAA.
LLVM Basic Block Representation.
bool canInstructionRangeModRef(const Instruction &I1, const Instruction &I2, const MemoryLocation &Loc, const ModRefInfo Mode)
Check if it is possible for the execution of the specified instructions to mod(according to the mode)...
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
bool isPointerTy() const
True if this is an instance of PointerType.
const Instruction & front() const
A manager for alias analyses.
Legacy wrapper pass to provide the CFLAndersAAResult object.
Represent the analysis usage information of a pass.
const Instruction & back() const
static bool doesAccessArgPointees(FunctionModRefBehavior MRB)
Checks if functions with the specified behavior are known to potentially read or write from objects p...
FunctionPass class - This class is used to implement most global optimizations.
amdgpu Simplify well known AMD library false FunctionCallee Value * Arg
TargetLibraryInfo & getTLI(const Function &F)
self_iterator getIterator()
bool onlyReadsMemory(const CallBase *Call)
Checks if the specified call is known to only read from non-volatile memory (or not access memory at ...
This class represents the va_arg llvm instruction, which returns an argument of the specified type gi...
AtomicOrdering getOrdering() const
Returns the ordering constraint of this rmw instruction.
void getAAResultsAnalysisUsage(AnalysisUsage &AU)
A helper for the legacy pass manager to populate AU to add uses to make sure the analyses required by...
Value * GetUnderlyingObject(Value *V, const DataLayout &DL, unsigned MaxLookup=6)
This method strips off any GEP address adjustments and pointer casts from the specified value...
INITIALIZE_PASS_END(RegBankSelect, DEBUG_TYPE, "Assign register bank of generic virtual registers", false, false) RegBankSelect
This file declares a simple ARC-aware AliasAnalysis using special knowledge of Objective C to enhance...
This function does not perform any non-local loads or stores to memory.
bool isByValArgument(unsigned ArgNo) const
Determine whether this argument is passed by value.
bool isIdentifiedFunctionLocal(const Value *V)
Return true if V is umabigously identified at the function-level.
The two locations may or may not alias. This is the least precise result.
const Value * Ptr
The address of the start of the location.
Representation for a specific memory location.
The two locations precisely alias each other.
Iterator for intrusive lists based on ilist_node.
INITIALIZE_PASS_BEGIN(AAResultsWrapperPass, "aa", "Function Alias Analysis Results", false, true) INITIALIZE_PASS_END(AAResultsWrapperPass
Legacy wrapper pass to provide the SCEVAAResult object.
ImmutablePass class - This class is used to provide information that does not need to be run...
Module.h This file contains the declarations for the Module class.
The access may modify the value stored in memory.
const Module * getModule() const
Return the module owning the function this instruction belongs to or nullptr it the function does not...
ModRefInfo callCapturesBefore(const Instruction *I, const MemoryLocation &MemLoc, DominatorTree *DT, OrderedBasicBlock *OBB=nullptr)
Return information about whether a particular call site modifies or reads the specified memory locati...
void setPreservesAll()
Set by analyses that do not transform their input at all.
LLVM_NODISCARD bool isNoModRef(const ModRefInfo MRI)
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
AAResults(const TargetLibraryInfo &TLI)
LLVM_NODISCARD bool isModSet(const ModRefInfo MRI)
static bool onlyAccessesArgPointees(FunctionModRefBehavior MRB)
Checks if functions with the specified behavior are known to read and write at most from objects poin...
unsigned getNumArgOperands() const
AtomicOrdering getOrdering() const
Returns the ordering constraint of this store instruction.
This file provides utility analysis objects describing memory locations.
LLVM_NODISCARD ModRefInfo intersectModRef(const ModRefInfo MRI1, const ModRefInfo MRI2)
bool onlyReadsMemory(unsigned OpNo) const
LLVM_NODISCARD std::enable_if<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type >::type dyn_cast(const Y &Val)
raw_ostream & operator<<(raw_ostream &OS, const APInt &I)
API to communicate dependencies between analyses during invalidation.
ModRefInfo getArgModRefInfo(const CallBase *Call, unsigned ArgIdx)
Get the ModRef info associated with a pointer argument of a call.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
AnalysisUsage & addUsedIfAvailable()
Add the specified Pass class to the set of analyses used by this pass.
LLVM Value Representation.
Legacy wrapper pass to provide the ObjCARCAAResult object.
AnalysisType * getAnalysisIfAvailable() const
getAnalysisIfAvailable<AnalysisType>() - Subclasses use this function to get analysis information tha...
void getAnalysisUsage(AnalysisUsage &AU) const override
getAnalysisUsage - This function should be overriden by passes that need analysis information to do t...
This class implements an extremely fast bulk output stream that can only output to a stream...
A wrapper pass for external alias analyses.
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
LLVM_NODISCARD ModRefInfo setModAndRef(const ModRefInfo MRI)
This is the interface for LLVM's primary stateless and local alias analysis.
bool isNoAliasArgument(const Value *V)
Return true if this is an argument with the noalias attribute.
LLVM_NODISCARD bool isModOrRefSet(const ModRefInfo MRI)
A wrapper pass to provide the legacy pass manager access to a suitably prepared AAResults object...
ModRefInfo getModRefInfo(const CallBase *Call, const MemoryLocation &Loc)
getModRefInfo (for call sites) - Return information about whether a particular call site modifies or ...
The two locations alias, but only due to a partial overlap.
bool canBasicBlockModify(const BasicBlock &BB, const MemoryLocation &Loc)
Check if it is possible for execution of the specified basic block to modify the location Loc...
A special type used by analysis passes to provide an address that identifies that particular analysis...
const BasicBlock * getParent() const
Legacy wrapper pass to provide the BasicAAResult object.
LLVM_NODISCARD bool isRefSet(const ModRefInfo MRI)