class AssumptionCache
Declaration
class AssumptionCache { /* full declaration omitted */ };
Description
A cache of @ llvm.assume calls within a function. This cache provides fast lookup of assumptions within a function by caching them and amortizing the cost of scanning for them across all queries. Passes that create new assumptions are required to call registerAssumption() to register any new @ llvm.assume calls that they create. Deletions of @ llvm.assume calls do not require special handling.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:42
Member Variables
- private llvm::Function& F
- We track this to lazily populate our assumptions.
- private llvm::TargetTransformInfo* TTI
- private SmallVector<llvm::AssumptionCache::ResultElem, 4> AssumeHandles
- Vector of weak value handles to calls of the @ llvm.assume intrinsic.
- private llvm::AssumptionCache::AffectedValuesMap AffectedValues
- private bool Scanned = false
- We want to be as lazy about this as possible, and so we scan the function at the last moment.
Method Overview
- public AssumptionCache(llvm::Function & F, llvm::TargetTransformInfo * TTI = nullptr)
- public MutableArrayRef<llvm::AssumptionCache::ResultElem> assumptions()
- public MutableArrayRef<llvm::AssumptionCache::ResultElem> assumptionsFor(const llvm::Value * V)
- public void clear()
- private SmallVector<llvm::AssumptionCache::ResultElem, 1> & getOrInsertAffectedValues(llvm::Value * V)
- public bool invalidate(llvm::Function &, const llvm::PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
- public void registerAssumption(llvm::AssumeInst * CI)
- private void scanFunction()
- private void transferAffectedValuesInCache(llvm::Value * OV, llvm::Value * NV)
- public void unregisterAssumption(llvm::AssumeInst * CI)
- public void updateAffectedValues(llvm::AssumeInst * CI)
Methods
¶AssumptionCache(
llvm::Function& F,
llvm::TargetTransformInfo* TTI = nullptr)
AssumptionCache(
llvm::Function& F,
llvm::TargetTransformInfo* TTI = nullptr)
Description
Construct an AssumptionCache from a function by scanning all of its instructions.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:109
Parameters
- llvm::Function& F
- llvm::TargetTransformInfo* TTI = nullptr
¶MutableArrayRef<llvm::AssumptionCache::ResultElem>
assumptions()
MutableArrayRef<llvm::AssumptionCache::ResultElem>
assumptions()
Description
Access the list of assumption handles currently tracked for this function. Note that these produce weak handles that may be null. The caller must handle that case. FIXME: We should replace this with pointee_iterator <filter _iterator < ...>> when we can write that to filter out the null values. Then caller code will become simpler.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:150
¶MutableArrayRef<llvm::AssumptionCache::ResultElem>
assumptionsFor(const llvm::Value* V)
MutableArrayRef<llvm::AssumptionCache::ResultElem>
assumptionsFor(const llvm::Value* V)
Description
Access the list of assumptions which affect this value.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:157
Parameters
- const llvm::Value* V
¶void clear()
void clear()
Description
Clear the cache of @ llvm.assume intrinsics for a function. It will be re-scanned the next time it is requested.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:136
¶SmallVector<llvm::AssumptionCache::ResultElem, 1>&
getOrInsertAffectedValues(llvm::Value* V)
SmallVector<llvm::AssumptionCache::ResultElem, 1>&
getOrInsertAffectedValues(llvm::Value* V)
Description
Get the vector of assumptions which affect a value from the cache.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:92
Parameters
- llvm::Value* V
¶bool invalidate(
llvm::Function&,
const llvm::PreservedAnalyses&,
FunctionAnalysisManager::Invalidator&)
bool invalidate(
llvm::Function&,
const llvm::PreservedAnalyses&,
FunctionAnalysisManager::Invalidator&)
Description
This cache is designed to be self-updating and so it should never be invalidated.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:114
Parameters
- llvm::Function&
- const llvm::PreservedAnalyses&
- FunctionAnalysisManager::Invalidator&
¶void registerAssumption(llvm::AssumeInst* CI)
void registerAssumption(llvm::AssumeInst* CI)
Description
Add an @ llvm.assume intrinsic to this function's cache. The call passed in must be an instruction within this function and must not already be in the cache.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:123
Parameters
- llvm::AssumeInst* CI
¶void scanFunction()
void scanFunction()
Description
Scan the function for assumptions and add them to the cache.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:104
¶void transferAffectedValuesInCache(
llvm::Value* OV,
llvm::Value* NV)
void transferAffectedValuesInCache(
llvm::Value* OV,
llvm::Value* NV)
Description
Move affected values in the cache for OV to be affected values for NV.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:95
Parameters
- llvm::Value* OV
- llvm::Value* NV
¶void unregisterAssumption(llvm::AssumeInst* CI)
void unregisterAssumption(llvm::AssumeInst* CI)
Description
Remove an @ llvm.assume intrinsic from this function's cache if it has been added to the cache earlier.
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:127
Parameters
- llvm::AssumeInst* CI
¶void updateAffectedValues(llvm::AssumeInst* CI)
void updateAffectedValues(llvm::AssumeInst* CI)
Description
Update the cache of values being affected by this assumption (i.e. the values about which this assumption provides information).
Declared at: llvm/include/llvm/Analysis/AssumptionCache.h:131
Parameters
- llvm::AssumeInst* CI