class MemoryDependenceResults
Declaration
class MemoryDependenceResults { /* full declaration omitted */ };
Description
Provides a lazy, caching interface for making common memory aliasing information queries, backed by LLVM's alias analysis passes. The dependency information returned is somewhat unusual, but is pragmatic. If queried about a store or call that might modify memory, the analysis will return the instruction[s] that may either load from that memory or store to it. If queried with a load or call that can never modify memory, the analysis will return calls and stores that might modify the pointer, but generally does not return loads unless a) they are volatile, or b) they load from *must-aliased* pointers. Returning a dependence on must-alias'd pointers instead of all pointers interacts well with the internal caching mechanism.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:265
Member Variables
- private llvm::MemoryDependenceResults::LocalDepMapType LocalDeps
- private DenseMap<AssertingVH<const llvm::Value>, llvm::NonLocalDepResult> NonLocalDefsCache
- Cache storing single nonlocal def for the instruction. It is set when nonlocal def would be found in function returning only local dependencies.
- private llvm::MemoryDependenceResults:: ReverseNonLocalDefsCacheTy ReverseNonLocalDefsCache
- private llvm::MemoryDependenceResults:: CachedNonLocalPointerInfo NonLocalPointerDeps
- private llvm::MemoryDependenceResults:: ReverseNonLocalPtrDepTy ReverseNonLocalPtrDeps
- private llvm::MemoryDependenceResults::NonLocalDepMapType NonLocalDepsMap
- private llvm::MemoryDependenceResults::ReverseDepMapType ReverseLocalDeps
- private llvm::MemoryDependenceResults::ReverseDepMapType ReverseNonLocalDeps
- private llvm::AAResults& AA
- Current AA implementation, just a cache.
- private llvm::AssumptionCache& AC
- private const llvm::TargetLibraryInfo& TLI
- private llvm::DominatorTree& DT
- private llvm::PhiValues& PV
- private llvm::PredIteratorCache PredCache
- private unsigned int DefaultBlockScanLimit
- private llvm::MemoryDependenceResults:: ClobberOffsetsMapType ClobberOffsets
Method Overview
- public MemoryDependenceResults(llvm::AAResults & AA, llvm::AssumptionCache & AC, const llvm::TargetLibraryInfo & TLI, llvm::DominatorTree & DT, llvm::PhiValues & PV, unsigned int DefaultBlockScanLimit)
- private llvm::MemDepResult getCallDependencyFrom(llvm::CallBase * Call, bool isReadOnlyCall, BasicBlock::iterator ScanIt, llvm::BasicBlock * BB)
- public Optional<int32_t> getClobberOffset(llvm::LoadInst * DepInst) const
- public unsigned int getDefaultBlockScanLimit() const
- public llvm::MemDepResult getDependency(llvm::Instruction * QueryInst)
- public llvm::MemDepResult getInvariantGroupPointerDependency(llvm::LoadInst * LI, llvm::BasicBlock * BB)
- public const llvm::MemoryDependenceResults::NonLocalDepInfo & getNonLocalCallDependency(llvm::CallBase * QueryCall)
- private llvm::MemDepResult getNonLocalInfoForBlock(llvm::Instruction * QueryInst, const llvm::MemoryLocation & Loc, bool isLoad, llvm::BasicBlock * BB, llvm::MemoryDependenceResults::NonLocalDepInfo * Cache, unsigned int NumSortedEntries, llvm::BatchAAResults & BatchAA)
- private bool getNonLocalPointerDepFromBB(llvm::Instruction * QueryInst, const llvm::PHITransAddr & Pointer, const llvm::MemoryLocation & Loc, bool isLoad, llvm::BasicBlock * BB, SmallVectorImpl<llvm::NonLocalDepResult> & Result, DenseMap<llvm::BasicBlock *, llvm::Value *> & Visited, bool SkipFirstBlock = false, bool IsIncomplete = false)
- public void getNonLocalPointerDependency(llvm::Instruction * QueryInst, SmallVectorImpl<llvm::NonLocalDepResult> & Result)
- public llvm::MemDepResult getPointerDependencyFrom(const llvm::MemoryLocation & Loc, bool isLoad, BasicBlock::iterator ScanIt, llvm::BasicBlock * BB, llvm::Instruction * QueryInst = nullptr, unsigned int * Limit = nullptr)
- public llvm::MemDepResult getPointerDependencyFrom(const llvm::MemoryLocation & Loc, bool isLoad, BasicBlock::iterator ScanIt, llvm::BasicBlock * BB, llvm::Instruction * QueryInst, unsigned int * Limit, llvm::BatchAAResults & BatchAA)
- public llvm::MemDepResult getSimplePointerDependencyFrom(const llvm::MemoryLocation & MemLoc, bool isLoad, BasicBlock::iterator ScanIt, llvm::BasicBlock * BB, llvm::Instruction * QueryInst, unsigned int * Limit, llvm::BatchAAResults & BatchAA)
- public bool invalidate(llvm::Function & F, const llvm::PreservedAnalyses & PA, FunctionAnalysisManager::Invalidator & Inv)
- public void invalidateCachedPointerInfo(llvm::Value * Ptr)
- public void invalidateCachedPredecessors()
- public void releaseMemory()
- private void removeCachedNonLocalPointerDependencies(llvm::MemoryDependenceResults::ValueIsLoadPair P)
- public void removeInstruction(llvm::Instruction * InstToRemove)
- private void verifyRemoved(llvm::Instruction * Inst) const
Methods
¶MemoryDependenceResults(
llvm::AAResults& AA,
llvm::AssumptionCache& AC,
const llvm::TargetLibraryInfo& TLI,
llvm::DominatorTree& DT,
llvm::PhiValues& PV,
unsigned int DefaultBlockScanLimit)
MemoryDependenceResults(
llvm::AAResults& AA,
llvm::AssumptionCache& AC,
const llvm::TargetLibraryInfo& TLI,
llvm::DominatorTree& DT,
llvm::PhiValues& PV,
unsigned int DefaultBlockScanLimit)
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:361
Parameters
- llvm::AAResults& AA
- llvm::AssumptionCache& AC
- const llvm::TargetLibraryInfo& TLI
- llvm::DominatorTree& DT
- llvm::PhiValues& PV
- unsigned int DefaultBlockScanLimit
¶llvm::MemDepResult getCallDependencyFrom(
llvm::CallBase* Call,
bool isReadOnlyCall,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB)
llvm::MemDepResult getCallDependencyFrom(
llvm::CallBase* Call,
bool isReadOnlyCall,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB)
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:481
Parameters
- llvm::CallBase* Call
- bool isReadOnlyCall
- BasicBlock::iterator ScanIt
- llvm::BasicBlock* BB
¶Optional<int32_t> getClobberOffset(
llvm::LoadInst* DepInst) const
Optional<int32_t> getClobberOffset(
llvm::LoadInst* DepInst) const
Description
Return the clobber offset to dependent instruction.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:473
Parameters
- llvm::LoadInst* DepInst
¶unsigned int getDefaultBlockScanLimit() const
unsigned int getDefaultBlockScanLimit() const
Description
Some methods limit the number of instructions they will examine. The return value of this method is the default limit that will be used if no limit is explicitly passed in.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:374
¶llvm::MemDepResult getDependency(
llvm::Instruction* QueryInst)
llvm::MemDepResult getDependency(
llvm::Instruction* QueryInst)
Description
Returns the instruction on which a memory operation depends. See the class comment for more details. It is illegal to call this on non-memory instructions.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:380
Parameters
- llvm::Instruction* QueryInst
¶llvm::MemDepResult
getInvariantGroupPointerDependency(
llvm::LoadInst* LI,
llvm::BasicBlock* BB)
llvm::MemDepResult
getInvariantGroupPointerDependency(
llvm::LoadInst* LI,
llvm::BasicBlock* BB)
Description
This analysis looks for other loads and stores with invariant.group metadata and the same pointer operand. Returns Unknown if it does not find anything, and Def if it can be assumed that 2 instructions load or store the same value and NonLocal which indicate that non-local Def was found, which can be retrieved by calling getNonLocalPointerDependency with the same queried instruction.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:467
Parameters
- llvm::LoadInst* LI
- llvm::BasicBlock* BB
¶const llvm::MemoryDependenceResults::
NonLocalDepInfo&
getNonLocalCallDependency(
llvm::CallBase* QueryCall)
const llvm::MemoryDependenceResults::
NonLocalDepInfo&
getNonLocalCallDependency(
llvm::CallBase* QueryCall)
Description
Perform a full dependency query for the specified call, returning the set of blocks that the value is potentially live across. The returned set of results will include a "NonLocal" result for all blocks where the value is live across. This method assumes the instruction returns a "NonLocal" dependency within its own block. This returns a reference to an internal data structure that may be invalidated on the next non-local query or when an instruction is removed. Clients must copy this data if they want it around longer than that.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:395
Parameters
- llvm::CallBase* QueryCall
¶llvm::MemDepResult getNonLocalInfoForBlock(
llvm::Instruction* QueryInst,
const llvm::MemoryLocation& Loc,
bool isLoad,
llvm::BasicBlock* BB,
llvm::MemoryDependenceResults::
NonLocalDepInfo* Cache,
unsigned int NumSortedEntries,
llvm::BatchAAResults& BatchAA)
llvm::MemDepResult getNonLocalInfoForBlock(
llvm::Instruction* QueryInst,
const llvm::MemoryLocation& Loc,
bool isLoad,
llvm::BasicBlock* BB,
llvm::MemoryDependenceResults::
NonLocalDepInfo* Cache,
unsigned int NumSortedEntries,
llvm::BatchAAResults& BatchAA)
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:492
Parameters
- llvm::Instruction* QueryInst
- const llvm::MemoryLocation& Loc
- bool isLoad
- llvm::BasicBlock* BB
- llvm::MemoryDependenceResults::NonLocalDepInfo* Cache
- unsigned int NumSortedEntries
- llvm::BatchAAResults& BatchAA
¶bool getNonLocalPointerDepFromBB(
llvm::Instruction* QueryInst,
const llvm::PHITransAddr& Pointer,
const llvm::MemoryLocation& Loc,
bool isLoad,
llvm::BasicBlock* BB,
SmallVectorImpl<llvm::NonLocalDepResult>&
Result,
DenseMap<llvm::BasicBlock*, llvm::Value*>&
Visited,
bool SkipFirstBlock = false,
bool IsIncomplete = false)
bool getNonLocalPointerDepFromBB(
llvm::Instruction* QueryInst,
const llvm::PHITransAddr& Pointer,
const llvm::MemoryLocation& Loc,
bool isLoad,
llvm::BasicBlock* BB,
SmallVectorImpl<llvm::NonLocalDepResult>&
Result,
DenseMap<llvm::BasicBlock*, llvm::Value*>&
Visited,
bool SkipFirstBlock = false,
bool IsIncomplete = false)
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:484
Parameters
- llvm::Instruction* QueryInst
- const llvm::PHITransAddr& Pointer
- const llvm::MemoryLocation& Loc
- bool isLoad
- llvm::BasicBlock* BB
- SmallVectorImpl<llvm::NonLocalDepResult>& Result
- DenseMap<llvm::BasicBlock*, llvm::Value*>& Visited
- bool SkipFirstBlock = false
- bool IsIncomplete = false
¶void getNonLocalPointerDependency(
llvm::Instruction* QueryInst,
SmallVectorImpl<llvm::NonLocalDepResult>&
Result)
void getNonLocalPointerDependency(
llvm::Instruction* QueryInst,
SmallVectorImpl<llvm::NonLocalDepResult>&
Result)
Description
Perform a full dependency query for an access to the QueryInst's specified memory location, returning the set of instructions that either define or clobber the value. Warning: For a volatile query instruction, the dependencies will be accurate, and thus usable for reordering, but it is never legal to remove the query instruction. This method assumes the pointer has a "NonLocal" dependency within QueryInst's parent basic block.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:407
Parameters
- llvm::Instruction* QueryInst
- SmallVectorImpl<llvm::NonLocalDepResult>& Result
¶llvm::MemDepResult getPointerDependencyFrom(
const llvm::MemoryLocation& Loc,
bool isLoad,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB,
llvm::Instruction* QueryInst = nullptr,
unsigned int* Limit = nullptr)
llvm::MemDepResult getPointerDependencyFrom(
const llvm::MemoryLocation& Loc,
bool isLoad,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB,
llvm::Instruction* QueryInst = nullptr,
unsigned int* Limit = nullptr)
Description
Returns the instruction on which a memory location depends. If isLoad is true, this routine ignores may-aliases with read-only operations. If isLoad is false, this routine ignores may-aliases with reads from read-only locations. If possible, pass the query instruction as well; this function may take advantage of the metadata annotated to the query instruction to refine the result. \p Limit can be used to set the maximum number of instructions that will be examined to find the pointer dependency. On return, it will be set to the number of instructions left to examine. If a null pointer is passed in, the limit will default to the value of -memdep-block-scan-limit. Note that this is an uncached query, and thus may be inefficient.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:442
Parameters
- const llvm::MemoryLocation& Loc
- bool isLoad
- BasicBlock::iterator ScanIt
- llvm::BasicBlock* BB
- llvm::Instruction* QueryInst = nullptr
- unsigned int* Limit = nullptr
¶llvm::MemDepResult getPointerDependencyFrom(
const llvm::MemoryLocation& Loc,
bool isLoad,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB,
llvm::Instruction* QueryInst,
unsigned int* Limit,
llvm::BatchAAResults& BatchAA)
llvm::MemDepResult getPointerDependencyFrom(
const llvm::MemoryLocation& Loc,
bool isLoad,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB,
llvm::Instruction* QueryInst,
unsigned int* Limit,
llvm::BatchAAResults& BatchAA)
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:448
Parameters
- const llvm::MemoryLocation& Loc
- bool isLoad
- BasicBlock::iterator ScanIt
- llvm::BasicBlock* BB
- llvm::Instruction* QueryInst
- unsigned int* Limit
- llvm::BatchAAResults& BatchAA
¶llvm::MemDepResult getSimplePointerDependencyFrom(
const llvm::MemoryLocation& MemLoc,
bool isLoad,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB,
llvm::Instruction* QueryInst,
unsigned int* Limit,
llvm::BatchAAResults& BatchAA)
llvm::MemDepResult getSimplePointerDependencyFrom(
const llvm::MemoryLocation& MemLoc,
bool isLoad,
BasicBlock::iterator ScanIt,
llvm::BasicBlock* BB,
llvm::Instruction* QueryInst,
unsigned int* Limit,
llvm::BatchAAResults& BatchAA)
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:456
Parameters
- const llvm::MemoryLocation& MemLoc
- bool isLoad
- BasicBlock::iterator ScanIt
- llvm::BasicBlock* BB
- llvm::Instruction* QueryInst
- unsigned int* Limit
- llvm::BatchAAResults& BatchAA
¶bool invalidate(
llvm::Function& F,
const llvm::PreservedAnalyses& PA,
FunctionAnalysisManager::Invalidator& Inv)
bool invalidate(
llvm::Function& F,
const llvm::PreservedAnalyses& PA,
FunctionAnalysisManager::Invalidator& Inv)
Description
Handle invalidation in the new PM.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:368
Parameters
- llvm::Function& F
- const llvm::PreservedAnalyses& PA
- FunctionAnalysisManager::Invalidator& Inv
¶void invalidateCachedPointerInfo(llvm::Value* Ptr)
void invalidateCachedPointerInfo(llvm::Value* Ptr)
Description
Invalidates cached information about the specified pointer, because it may be too conservative in memdep. This is an optional call that can be used when the client detects an equivalence between the pointer and some other value and replaces the other value with ptr. This can make Ptr available in more places that cached info does not necessarily keep.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:421
Parameters
- llvm::Value* Ptr
¶void invalidateCachedPredecessors()
void invalidateCachedPredecessors()
Description
Clears the PredIteratorCache info. This needs to be done when the CFG changes, e.g., due to splitting critical edges.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:427
¶void releaseMemory()
void releaseMemory()
Description
Release memory in caches.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:470
¶void removeCachedNonLocalPointerDependencies(
llvm::MemoryDependenceResults::ValueIsLoadPair
P)
void removeCachedNonLocalPointerDependencies(
llvm::MemoryDependenceResults::ValueIsLoadPair
P)
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:498
Parameters
¶void removeInstruction(
llvm::Instruction* InstToRemove)
void removeInstruction(
llvm::Instruction* InstToRemove)
Description
Removes an instruction from the dependence analysis, updating the dependence of instructions that previously depended on it.
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:412
Parameters
- llvm::Instruction* InstToRemove
¶void verifyRemoved(llvm::Instruction* Inst) const
void verifyRemoved(llvm::Instruction* Inst) const
Declared at: llvm/include/llvm/Analysis/MemoryDependenceAnalysis.h:500
Parameters
- llvm::Instruction* Inst