|
LLVM 24.0.0git
|
#include "llvm/Analysis/AliasAnalysis.h"
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<typename AAResultT> | |
| 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 | onlyReadsMemory (const CallBase *Call) |
| Checks if the specified call 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. | |
Definition at line 325 of file AliasAnalysis.h.
| AAResults::AAResults | ( | const TargetLibraryInfo & | TLI | ) |
Definition at line 61 of file AliasAnalysis.cpp.
Referenced by AAResults().
| AAResults::AAResults | ( | AAResults && | Arg | ) |
Definition at line 63 of file AliasAnalysis.cpp.
References AAResults(), and llvm::move().
|
default |
References LLVM_ABI.
|
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 346 of file AliasAnalysis.h.
|
inline |
Register a specific AA result.
Definition at line 334 of file AliasAnalysis.h.
Referenced by llvm::AMDGPUPassConfig::addIRPasses().
| AliasResult AAResults::alias | ( | const MemoryLocation & | LocA, |
| const MemoryLocation & | LocB ) |
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 92 of file AliasAnalysis.cpp.
References alias().
Referenced by alias(), alias(), alias(), callCapturesBefore(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), llvm::BasicAAResult::getModRefInfo(), isMustAlias(), isMustAlias(), and isNoAlias().
| AliasResult AAResults::alias | ( | const MemoryLocation & | LocA, |
| const MemoryLocation & | LocB, | ||
| AAQueryInfo & | AAQI, | ||
| const Instruction * | CtxI = nullptr ) |
Definition at line 98 of file AliasAnalysis.cpp.
References assert(), llvm::dbgs(), llvm::AAQueryInfo::Depth, llvm::getAnalysisOptions(), llvm::Value::getContext(), llvm::Value::getType(), I, llvm::Type::isPointerTy(), llvm::AliasResult::MayAlias, llvm::AliasResult::MustAlias, llvm::AliasResult::NoAlias, llvm::MemoryLocation::Ptr, and llvm::MemoryLocation::Size.
|
inline |
A convenience wrapper around the primary alias interface.
Definition at line 373 of file AliasAnalysis.h.
References alias(), llvm::MemoryLocation::getBeforeOrAfter(), and llvm::V1.
|
inline |
A convenience wrapper around the primary alias interface.
Definition at line 367 of file AliasAnalysis.h.
| AliasResult AAResults::aliasErrno | ( | const MemoryLocation & | Loc, |
| const Instruction * | CtxI ) |
Definition at line 145 of file AliasAnalysis.cpp.
References llvm::AliasResult::MayAlias.
Referenced by llvm::BasicAAResult::getModRefInfo().
| ModRefInfo AAResults::callCapturesBefore | ( | const Instruction * | I, |
| const MemoryLocation & | MemLoc, | ||
| DominatorTree * | DT, | ||
| AAQueryInfo & | AAQI ) |
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 680 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.
| bool AAResults::canBasicBlockModify | ( | const BasicBlock & | BB, |
| const MemoryLocation & | Loc ) |
Check if it is possible for execution of the specified basic block to modify the location Loc.
canBasicBlockModify - Return true if it is possible for execution of the specified basic block to modify the location Loc.
Definition at line 741 of file AliasAnalysis.cpp.
References llvm::BasicBlock::back(), canInstructionRangeModRef(), llvm::BasicBlock::front(), and llvm::Mod.
Referenced by findArgParts().
| bool AAResults::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.
canInstructionRangeModRef - Return true if it is possible for the execution of the specified instructions to mod(according to the mode) the location Loc.
The instructions to consider are all of the instructions in the range of [I1,I2] INCLUSIVE. I1 and I2 must be in the same basic block.
Definition at line 751 of file AliasAnalysis.cpp.
References assert(), llvm::ilist_node_impl< OptionsT >::getIterator(), getModRefInfo(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), I, and llvm::isModOrRefSet().
Referenced by canBasicBlockModify(), and findArgParts().
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 465 of file AliasAnalysis.h.
References Call, llvm::MemoryEffectsBase< LocationEnum >::doesNotAccessMemory(), and getMemoryEffects().
| ModRefInfo AAResults::getArgModRefInfo | ( | const CallBase * | Call, |
| unsigned | ArgIdx ) |
Get the ModRef info associated with a pointer argument of a call.
The result's bits are set to indicate the allowed aliasing ModRef kinds. Note that these bits do not necessarily account for the overall behavior of the function, but rather only provide additional per-argument information.
Definition at line 179 of file AliasAnalysis.cpp.
References Call, llvm::isNoModRef(), llvm::ModRef, and llvm::NoModRef.
Referenced by getModRefInfo(), and llvm::BasicAAResult::getModRefInfo().
| MemoryEffects AAResults::getMemoryEffects | ( | const CallBase * | Call | ) |
Return the behavior of the given call site.
Definition at line 413 of file AliasAnalysis.cpp.
References Call, and getMemoryEffects().
Referenced by AddAliasScopeMetadata(), llvm::objcarc::CanAlterRefCount(), llvm::canSinkOrHoistInst(), checkFunctionMemoryAccess(), doesNotAccessMemory(), getMemoryEffects(), llvm::BasicAAResult::getMemoryEffects(), getModRefInfo(), getModRefInfo(), llvm::BasicAAResult::getModRefInfo(), and onlyReadsMemory().
| MemoryEffects AAResults::getMemoryEffects | ( | const CallBase * | Call, |
| AAQueryInfo & | AAQI ) |
Definition at line 398 of file AliasAnalysis.cpp.
References Call, and llvm::MemoryEffectsBase< IRMemLocation >::unknown().
| MemoryEffects AAResults::getMemoryEffects | ( | const Function * | F | ) |
Return the behavior when calling the given function.
Definition at line 418 of file AliasAnalysis.cpp.
References F, and llvm::MemoryEffectsBase< IRMemLocation >::unknown().
| ModRefInfo AAResults::getModRefInfo | ( | const AtomicCmpXchgInst * | CX, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 599 of file AliasAnalysis.cpp.
References alias(), llvm::MemoryLocation::get(), llvm::AtomicCmpXchgInst::getMergedOrdering(), llvm::getSyncEffects(), llvm::isStrongerThanMonotonic(), llvm::ModRef, llvm::AliasResult::NoAlias, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const AtomicRMWInst * | RMW, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 617 of file AliasAnalysis.cpp.
References alias(), llvm::MemoryLocation::get(), llvm::AtomicRMWInst::getOrdering(), llvm::getSyncEffects(), llvm::isStrongerThanMonotonic(), llvm::ModRef, llvm::AliasResult::NoAlias, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const CallBase * | Call, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 220 of file AliasAnalysis.cpp.
References Call, getModRefInfoMask(), llvm::isNoModRef(), llvm::ModRef, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const CallBase * | Call1, |
| const CallBase * | Call2, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 265 of file AliasAnalysis.cpp.
References llvm::CallBase::arg_begin(), llvm::CallBase::arg_end(), getArgModRefInfo(), llvm::MemoryLocation::getForArgument(), getMemoryEffects(), getModRefInfo(), getModRefInfoInaccessibleAndTargetMemLoc(), llvm::Value::getType(), I, llvm::isModOrRefSet(), llvm::isModSet(), llvm::isNoModRef(), llvm::Type::isPointerTy(), llvm::isRefSet(), llvm::Mod, llvm::ModRef, llvm::NoModRef, and llvm::Ref.
| ModRefInfo AAResults::getModRefInfo | ( | const CatchPadInst * | I, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 573 of file AliasAnalysis.cpp.
References getModRefInfoMask(), and llvm::ModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const CatchReturnInst * | I, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 586 of file AliasAnalysis.cpp.
References getModRefInfoMask(), and llvm::ModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const FenceInst * | S, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 535 of file AliasAnalysis.cpp.
References F, llvm::getSyncEffects(), llvm::isNoModRef(), llvm::ModRef, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const Instruction * | I, |
| const CallBase * | Call ) |
Return information about whether a call and an instruction may refer to the same memory locations.
Definition at line 193 of file AliasAnalysis.cpp.
References getModRefInfo(), and I.
| ModRefInfo AAResults::getModRefInfo | ( | const Instruction * | I, |
| const CallBase * | Call2, | ||
| AAQueryInfo & | AAQIP ) |
Definition at line 199 of file AliasAnalysis.cpp.
References llvm::dyn_cast(), llvm::MemoryLocation::get(), getModRefInfo(), I, llvm::isModOrRefSet(), llvm::ModRef, and llvm::NoModRef.
|
inline |
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 492 of file AliasAnalysis.h.
References getModRefInfo(), and I.
Referenced by canInstructionRangeModRef(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), and isArgUnmodifiedByAllCalls().
| ModRefInfo AAResults::getModRefInfo | ( | const Instruction * | I, |
| const std::optional< MemoryLocation > & | OptLoc, | ||
| AAQueryInfo & | AAQIP ) |
Definition at line 635 of file AliasAnalysis.cpp.
References assert(), Call, llvm::dyn_cast(), getMemoryEffects(), llvm::MemoryEffectsBase< LocationEnum >::getModRef(), getModRefInfo(), I, and llvm::NoModRef.
|
inline |
A convenience wrapper for constructing the memory location.
Definition at line 499 of file AliasAnalysis.h.
References getModRefInfo(), I, P, and llvm::Size.
| ModRefInfo AAResults::getModRefInfo | ( | const Instruction * | I1, |
| const Instruction * | I2 ) |
Return information about whether two instructions may refer to the same memory locations.
Definition at line 378 of file AliasAnalysis.cpp.
References getModRefInfo().
| ModRefInfo AAResults::getModRefInfo | ( | const Instruction * | I1, |
| const Instruction * | I2, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 384 of file AliasAnalysis.cpp.
References llvm::dyn_cast(), getModRefInfo(), llvm::MemoryLocation::getOrNone(), llvm::isModOrRefSet(), llvm::Instruction::mayReadOrWriteMemory(), llvm::ModRef, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const LoadInst * | L, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 482 of file AliasAnalysis.cpp.
References alias(), llvm::MemoryLocation::get(), llvm::getSyncEffects(), llvm::isStrongerThanMonotonic(), llvm::isStrongerThanUnordered(), llvm::ModRef, llvm::AliasResult::NoAlias, llvm::NoModRef, and llvm::Ref.
| ModRefInfo AAResults::getModRefInfo | ( | const StoreInst * | S, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 505 of file AliasAnalysis.cpp.
References alias(), llvm::MemoryLocation::get(), getModRefInfoMask(), llvm::StoreInst::getOrdering(), llvm::getSyncEffects(), llvm::isModSet(), llvm::isStrongerThanMonotonic(), llvm::isStrongerThanUnordered(), llvm::Mod, llvm::ModRef, llvm::AliasResult::NoAlias, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfo | ( | const VAArgInst * | V, |
| const MemoryLocation & | Loc, | ||
| AAQueryInfo & | AAQI ) |
Definition at line 554 of file AliasAnalysis.cpp.
References alias(), llvm::MemoryLocation::get(), getModRefInfoMask(), llvm::ModRef, llvm::AliasResult::NoAlias, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfoMask | ( | const MemoryLocation & | Loc, |
| AAQueryInfo & | AAQI, | ||
| bool | IgnoreLocals = false ) |
Definition at line 164 of file AliasAnalysis.cpp.
References llvm::isNoModRef(), llvm::ModRef, and llvm::NoModRef.
| ModRefInfo AAResults::getModRefInfoMask | ( | const MemoryLocation & | Loc, |
| bool | IgnoreLocals = false ) |
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 158 of file AliasAnalysis.cpp.
References getModRefInfoMask().
Referenced by addLocAccess(), llvm::canHoistLoad(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfo(), getModRefInfoMask(), getModRefInfoMask(), and pointsToConstantMemory().
|
inline |
A convenience wrapper around the primary getModRefInfoMask interface.
Definition at line 437 of file AliasAnalysis.h.
References llvm::MemoryLocation::getBeforeOrAfter(), getModRefInfoMask(), and P.
| bool AAResults::invalidate | ( | Function & | F, |
| const PreservedAnalyses & | PA, | ||
| FunctionAnalysisManager::Invalidator & | Inv ) |
Handle invalidation events in the new pass manager.
The aggregation is invalidated if any of the underlying analyses is invalidated.
Definition at line 68 of file AliasAnalysis.cpp.
References F, and llvm::PreservedAnalyses::getChecker().
|
inline |
A trivial helper function to check to see if the specified pointers are must-alias.
Definition at line 398 of file AliasAnalysis.h.
References alias(), and llvm::AliasResult::MustAlias.
A convenience wrapper around the isMustAlias helper interface.
Definition at line 403 of file AliasAnalysis.h.
References alias(), llvm::AliasResult::MustAlias, llvm::LocationSize::precise(), and llvm::V1.
|
inline |
A trivial helper function to check to see if the specified pointers are no-alias.
Definition at line 380 of file AliasAnalysis.h.
References alias(), and llvm::AliasResult::NoAlias.
Referenced by isNoAlias(), and isNoAlias().
A convenience wrapper around the isNoAlias helper interface.
Definition at line 391 of file AliasAnalysis.h.
References llvm::MemoryLocation::getBeforeOrAfter(), isNoAlias(), and llvm::V1.
|
inline |
A convenience wrapper around the isNoAlias helper interface.
Definition at line 385 of file AliasAnalysis.h.
References isNoAlias(), and llvm::V1.
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 478 of file AliasAnalysis.h.
References Call, getMemoryEffects(), and llvm::MemoryEffectsBase< LocationEnum >::onlyReadsMemory().
|
inline |
Checks whether the given location points to constant memory, or if OrLocal is true whether it points to a local alloca.
Definition at line 410 of file AliasAnalysis.h.
References getModRefInfoMask(), and llvm::isNoModRef().
Referenced by pointsToConstantMemory().
A convenience wrapper around the primary pointsToConstantMemory interface.
Definition at line 416 of file AliasAnalysis.h.
References llvm::MemoryLocation::getBeforeOrAfter(), P, and pointsToConstantMemory().
|
friend |
Definition at line 591 of file AliasAnalysis.h.
References AAResultBase.
Referenced by AAResultBase.
|
friend |
Definition at line 599 of file AliasAnalysis.h.
References BatchAAResults.
Referenced by BatchAAResults.