LLVM: llvm::AAResults Class Reference (original) (raw)

#include "[llvm/Analysis/AliasAnalysis.h](AliasAnalysis%5F8h%5Fsource.html)"

Classes
class Concept
A private abstract base class describing the concept of an individual alias analysis implementation. More...
Public Member Functions
LLVM_ABI AAResults (const TargetLibraryInfo &TLI)
LLVM_ABI AAResults (AAResults &&Arg)
LLVM_ABI ~AAResults ()
template
void addAAResult (AAResultT &AAResult)
Register a specific AA result.
void addAADependencyID (AnalysisKey *ID)
Register a function analysis ID that the results aggregation depends on.
LLVM_ABI bool invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
Handle invalidation events in the new pass manager.
Alias Queries
LLVM_ABI AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB)
The main low level interface to the alias analysis implementation.
AliasResult alias (const Value *V1, LocationSize V1Size, const Value *V2, LocationSize V2Size)
A convenience wrapper around the primary alias interface.
AliasResult alias (const Value *V1, const Value *V2)
A convenience wrapper around the primary alias interface.
bool isNoAlias (const MemoryLocation &LocA, const MemoryLocation &LocB)
A trivial helper function to check to see if the specified pointers are no-alias.
bool isNoAlias (const Value *V1, LocationSize V1Size, const Value *V2, LocationSize V2Size)
A convenience wrapper around the isNoAlias helper interface.
bool isNoAlias (const Value *V1, const Value *V2)
A convenience wrapper around the isNoAlias helper interface.
bool isMustAlias (const MemoryLocation &LocA, const MemoryLocation &LocB)
A trivial helper function to check to see if the specified pointers are must-alias.
bool isMustAlias (const Value *V1, const Value *V2)
A convenience wrapper around the isMustAlias helper interface.
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 to a local alloca.
bool pointsToConstantMemory (const Value *P, bool OrLocal=false)
A convenience wrapper around the primary pointsToConstantMemory interface.
Simple mod/ref information
LLVM_ABI ModRefInfo getModRefInfoMask (const MemoryLocation &Loc, bool IgnoreLocals=false)
Returns a bitmask that should be unconditionally applied to the ModRef info of a memory location.
ModRefInfo getModRefInfoMask (const Value *P, bool IgnoreLocals=false)
A convenience wrapper around the primary getModRefInfoMask interface.
LLVM_ABI ModRefInfo getArgModRefInfo (const CallBase *Call, unsigned ArgIdx)
Get the ModRef info associated with a pointer argument of a call.
LLVM_ABI MemoryEffects getMemoryEffects (const CallBase *Call)
Return the behavior of the given call site.
LLVM_ABI MemoryEffects getMemoryEffects (const Function *F)
Return the behavior when calling the given function.
bool doesNotAccessMemory (const CallBase *Call)
Checks if the specified call is known to never read or write memory.
bool doesNotAccessMemory (const Function *F)
Checks if the specified function is known to never read or write memory.
bool onlyReadsMemory (const CallBase *Call)
Checks if the specified call is known to only read from non-volatile memory (or not access memory at all).
bool onlyReadsMemory (const Function *F)
Checks if the specified function is known to only read from non-volatile memory (or not access memory at all).
ModRefInfo getModRefInfo (const Instruction *I, const std::optional< MemoryLocation > &OptLoc)
Check whether or not an instruction may read or write the optionally specified memory location.
ModRefInfo getModRefInfo (const Instruction *I, const Value *P, LocationSize Size)
A convenience wrapper for constructing the memory location.
LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call)
Return information about whether a call and an instruction may refer to the same memory locations.
LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2)
Return information about whether two instructions may refer to the same memory locations.
ModRefInfo callCapturesBefore (const Instruction *I, const MemoryLocation &MemLoc, DominatorTree *DT)
Return information about whether a particular call site modifies or reads the specified memory location MemLoc before instruction I in a BasicBlock.
ModRefInfo callCapturesBefore (const Instruction *I, const Value *P, LocationSize Size, DominatorTree *DT)
A convenience wrapper to synthesize a memory location.
Higher level methods for querying mod/ref information.
class AAResultBase
class BatchAAResults
LLVM_ABI 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.
bool canBasicBlockModify (const BasicBlock &BB, const Value *P, LocationSize Size)
A convenience wrapper synthesizing a memory location.
LLVM_ABI 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) the location Loc.
bool canInstructionRangeModRef (const Instruction &I1, const Instruction &I2, const Value *Ptr, LocationSize Size, const ModRefInfo Mode)
A convenience wrapper synthesizing a memory location.
LLVM_ABI AliasResult alias (const MemoryLocation &LocA, const MemoryLocation &LocB, AAQueryInfo &AAQI, const Instruction *CtxI=nullptr)
LLVM_ABI AliasResult aliasErrno (const MemoryLocation &Loc, const Module *M)
LLVM_ABI ModRefInfo getModRefInfoMask (const MemoryLocation &Loc, AAQueryInfo &AAQI, bool IgnoreLocals=false)
LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I, const CallBase *Call2, AAQueryInfo &AAQIP)
LLVM_ABI ModRefInfo getModRefInfo (const CallBase *Call, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const CallBase *Call1, const CallBase *Call2, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const VAArgInst *V, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const LoadInst *L, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const StoreInst *S, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const FenceInst *S, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const AtomicCmpXchgInst *CX, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const AtomicRMWInst *RMW, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const CatchPadInst *I, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const CatchReturnInst *I, const MemoryLocation &Loc, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I, const std::optional< MemoryLocation > &OptLoc, AAQueryInfo &AAQIP)
LLVM_ABI ModRefInfo getModRefInfo (const Instruction *I1, const Instruction *I2, AAQueryInfo &AAQI)
LLVM_ABI ModRefInfo callCapturesBefore (const Instruction *I, const MemoryLocation &MemLoc, DominatorTree *DT, AAQueryInfo &AAQIP)
Return information about whether a particular call site modifies or reads the specified memory location MemLoc before instruction I in a BasicBlock.
LLVM_ABI MemoryEffects getMemoryEffects (const CallBase *Call, AAQueryInfo &AAQI)

Definition at line 318 of file AliasAnalysis.h.

AAResults() [2/2]

~AAResults()

AAResults::~AAResults ( ) default

addAADependencyID()

void llvm::AAResults::addAADependencyID ( AnalysisKey * ID) inline

Register a function analysis ID that the results aggregation depends on.

This is used in the new pass manager to implement the invalidation logic where we must invalidate the results aggregation if any of our component analyses become invalid.

Definition at line 339 of file AliasAnalysis.h.

addAAResult()

template

void llvm::AAResults::addAAResult ( AAResultT & AAResult) inline

alias() [1/4]

The main low level interface to the alias analysis implementation.

Returns an AliasResult indicating whether the two pointers are aliased to each other. This is the interface that must be implemented by specific alias analysis implementations.

Definition at line 104 of file AliasAnalysis.cpp.

References alias().

Referenced by alias(), alias(), alias(), callCapturesBefore(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), llvm::BasicAAResult::getModRefInfo(), isMustAlias(), isMustAlias(), and isNoAlias().

alias() [2/4]

Definition at line 110 of file AliasAnalysis.cpp.

References assert(), llvm::dbgs(), llvm::AAQueryInfo::Depth, EnableAATrace, llvm::Value::getType(), I, llvm::Type::isPointerTy(), llvm::AliasResult::MayAlias, llvm::AliasResult::MustAlias, llvm::AliasResult::NoAlias, llvm::MemoryLocation::Ptr, and llvm::MemoryLocation::Size.

alias() [3/4]

alias() [4/4]

A convenience wrapper around the primary alias interface.

Definition at line 360 of file AliasAnalysis.h.

References alias().

aliasErrno()

callCapturesBefore() [1/3]

callCapturesBefore() [2/3]

Return information about whether a particular call site modifies or reads the specified memory location MemLoc before instruction I in a BasicBlock.

FIXME: this is really just shoring-up a deficiency in alias analysis. BasicAA isn't willing to spend linear time determining whether an alloca was captured before or after this particular call, while we are. However, with a smarter AA in place, this test is just wasting compile time.

Definition at line 626 of file AliasAnalysis.cpp.

References alias(), Call, llvm::capturesAnyProvenance(), llvm::capturesAnything(), llvm::dyn_cast(), llvm::MemoryLocation::getBeforeOrAfter(), llvm::CaptureInfo::getOtherComponents(), llvm::getUnderlyingObject(), I, llvm::isIdentifiedFunctionLocal(), llvm::ModRef, llvm::AliasResult::NoAlias, llvm::NoModRef, llvm::PointerMayBeCapturedBefore(), llvm::Provenance, llvm::MemoryLocation::Ptr, and llvm::Ref.

callCapturesBefore() [3/3]

canBasicBlockModify() [1/2]

canBasicBlockModify() [2/2]

canInstructionRangeModRef() [1/2]

canInstructionRangeModRef() [2/2]

doesNotAccessMemory() [1/2]

Checks if the specified call is known to never read or write memory.

Note that if the call only reads from known-constant memory, it is also legal to return true. Also, calls that unwind the stack are legal for this predicate.

Many optimizations (such as CSE and LICM) can be performed on such calls without worrying about aliasing properties, and many calls have this property (e.g. calls to 'sin' and 'cos').

This property corresponds to the GCC 'const' attribute.

Definition at line 458 of file AliasAnalysis.h.

References Call, llvm::MemoryEffectsBase< LocationEnum >::doesNotAccessMemory(), and getMemoryEffects().

doesNotAccessMemory() [2/2]

Checks if the specified function is known to never read or write memory.

Note that if the function only reads from known-constant memory, it is also legal to return true. Also, function that unwind the stack are legal for this predicate.

Many optimizations (such as CSE and LICM) can be performed on such calls to such functions without worrying about aliasing properties, and many functions have this property (e.g. 'sin' and 'cos').

This property corresponds to the GCC 'const' attribute.

Definition at line 473 of file AliasAnalysis.h.

References llvm::MemoryEffectsBase< LocationEnum >::doesNotAccessMemory(), F, and getMemoryEffects().

getArgModRefInfo()

getMemoryEffects() [1/3]

Return the behavior of the given call site.

Definition at line 389 of file AliasAnalysis.cpp.

References Call, and getMemoryEffects().

Referenced by AddAliasScopeMetadata(), llvm::objcarc::CanAlterRefCount(), checkFunctionMemoryAccess(), doesNotAccessMemory(), doesNotAccessMemory(), getMemoryEffects(), llvm::BasicAAResult::getMemoryEffects(), getModRefInfo(), getModRefInfo(), llvm::BasicAAResult::getModRefInfo(), onlyReadsMemory(), and onlyReadsMemory().

getMemoryEffects() [2/3]

getMemoryEffects() [3/3]

getModRefInfo() [1/17]

getModRefInfo() [2/17]

getModRefInfo() [3/17]

getModRefInfo() [4/17]

Definition at line 247 of file AliasAnalysis.cpp.

References llvm::CallBase::arg_begin(), llvm::CallBase::arg_end(), getArgModRefInfo(), llvm::MemoryLocation::getForArgument(), getMemoryEffects(), getModRefInfo(), llvm::Value::getType(), I, llvm::isModOrRefSet(), llvm::isModSet(), llvm::isNoModRef(), llvm::Type::isPointerTy(), llvm::isRefSet(), llvm::Mod, llvm::ModRef, llvm::NoModRef, and llvm::Ref.

getModRefInfo() [5/17]

getModRefInfo() [6/17]

getModRefInfo() [7/17]

getModRefInfo() [8/17]

Return information about whether a call and an instruction may refer to the same memory locations.

Definition at line 198 of file AliasAnalysis.cpp.

References getModRefInfo(), and I.

getModRefInfo() [9/17]

getModRefInfo() [10/17]

Check whether or not an instruction may read or write the optionally specified memory location.

An instruction that doesn't read or write memory may be trivially LICM'd for example.

For function calls, this delegates to the alias-analysis specific call-site mod-ref behavior queries. Otherwise it delegates to the specific helpers above.

Definition at line 513 of file AliasAnalysis.h.

References getModRefInfo(), and I.

Referenced by canInstructionRangeModRef(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), and isArgUnmodifiedByAllCalls().

getModRefInfo() [11/17]

getModRefInfo() [12/17]

getModRefInfo() [13/17]

getModRefInfo() [14/17]

getModRefInfo() [15/17]

getModRefInfo() [16/17]

Definition at line 457 of file AliasAnalysis.cpp.

References alias(), assert(), llvm::MemoryLocation::get(), getModRefInfoMask(), llvm::StoreInst::getOrdering(), llvm::isModSet(), llvm::isStrongerThanMonotonic(), llvm::isStrongerThanUnordered(), llvm::Mod, llvm::ModRef, llvm::AliasResult::NoAlias, and llvm::NoModRef.

getModRefInfo() [17/17]

getModRefInfoMask() [1/3]

getModRefInfoMask() [2/3]

Returns a bitmask that should be unconditionally applied to the ModRef info of a memory location.

This allows us to eliminate Mod and/or Ref from the ModRef info based on the knowledge that the memory location points to constant and/or locally-invariant memory.

If IgnoreLocals is true, then this method returns NoModRef for memory that points to a local alloca.

Definition at line 163 of file AliasAnalysis.cpp.

References getModRefInfoMask().

Referenced by addLocAccess(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfoMask(), getModRefInfoMask(), and pointsToConstantMemory().

getModRefInfoMask() [3/3]

invalidate()

isMustAlias() [1/2]

isMustAlias() [2/2]

isNoAlias() [1/3]

isNoAlias() [2/3]

isNoAlias() [3/3]

onlyReadsMemory() [1/2]

Checks if the specified call is known to only read from non-volatile memory (or not access memory at all).

Calls that unwind the stack are legal for this predicate.

This property allows many common optimizations to be performed in the absence of interfering store instructions, such as CSE of strlen calls.

This property corresponds to the GCC 'pure' attribute.

Definition at line 486 of file AliasAnalysis.h.

References Call, getMemoryEffects(), and llvm::MemoryEffectsBase< LocationEnum >::onlyReadsMemory().

onlyReadsMemory() [2/2]

Checks if the specified function is known to only read from non-volatile memory (or not access memory at all).

Functions that unwind the stack are legal for this predicate.

This property allows many common optimizations to be performed in the absence of interfering store instructions, such as CSE of strlen calls.

This property corresponds to the GCC 'pure' attribute.

Definition at line 499 of file AliasAnalysis.h.

References F, getMemoryEffects(), and llvm::MemoryEffectsBase< LocationEnum >::onlyReadsMemory().

pointsToConstantMemory() [1/2]

pointsToConstantMemory() [2/2]

AAResultBase

BatchAAResults


The documentation for this class was generated from the following files: