15#ifndef LLVM_ANALYSIS_ASSUMPTIONCACHE_H
16#define LLVM_ANALYSIS_ASSUMPTIONCACHE_H
32class TargetTransformInfo;
46 enum :
unsigned {
ExprResultIdx = std::numeric_limits<unsigned>::max() };
69 class AffectedValueCallbackVH final :
public CallbackVH {
72 void deleted()
override;
73 void allUsesReplacedWith(
Value *)
override;
82 friend AffectedValueCallbackVH;
86 using AffectedValuesMap =
87 DenseMap<AffectedValueCallbackVH, SmallVector<ResultElem, 1>,
88 AffectedValueCallbackVH::DMI>;
89 AffectedValuesMap AffectedValues;
92 SmallVector<ResultElem, 1> &getOrInsertAffectedValues(Value *V);
95 void transferAffectedValuesInCache(Value *OV, Value *NV);
101 bool Scanned =
false;
137 AssumeHandles.
clear();
138 AffectedValues.clear();
153 return AssumeHandles;
161 auto AVI = AffectedValues.find_as(
const_cast<Value *
>(V));
162 if (AVI == AffectedValues.end())
207 class FunctionCallbackVH final :
public CallbackVH {
210 void deleted()
override;
219 friend FunctionCallbackVH;
This file defines DenseMapInfo traits for DenseMap.
This file defines the DenseMap class.
This header defines various interfaces for pass management in LLVM.
This file defines the SmallVector class.
API to communicate dependencies between analyses during invalidation.
A container for analyses that lazily runs them and caches their results.
This represents the llvm.assume intrinsic.
A function analysis which provides an AssumptionCache.
AssumptionCache run(Function &F, FunctionAnalysisManager &)
An immutable pass that tracks lazily created AssumptionCache objects.
bool doFinalization(Module &) override
doFinalization - Virtual method overriden by subclasses to do any necessary clean up after all passes...
~AssumptionCacheTracker() override
AssumptionCache * lookupAssumptionCache(Function &F)
Return the cached assumptions for a function if it has already been scanned.
void releaseMemory() override
releaseMemory() - This member can be implemented by a pass if it wants to be able to release its memo...
void verifyAnalysis() const override
verifyAnalysis() - This member can be implemented by a analysis pass to check state of analysis infor...
AssumptionCache & getAssumptionCache(Function &F)
Get the cached assumptions for a function.
A cache of @llvm.assume calls within a function.
void registerAssumption(AssumeInst *CI)
Add an @llvm.assume intrinsic to this function's cache.
void clear()
Clear the cache of @llvm.assume intrinsics for a function.
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
This cache is designed to be self-updating and so it should never be invalidated.
void updateAffectedValues(AssumeInst *CI)
Update the cache of values being affected by this assumption (i.e.
MutableArrayRef< ResultElem > assumptions()
Access the list of assumption handles currently tracked for this function.
void unregisterAssumption(AssumeInst *CI)
Remove an @llvm.assume intrinsic from this function's cache if it has been added to the cache earlier...
AssumptionCache(Function &F, TargetTransformInfo *TTI=nullptr)
Construct an AssumptionCache from a function by scanning all of its instructions.
MutableArrayRef< ResultElem > assumptionsFor(const Value *V)
Access the list of assumptions which affect this value.
Printer pass for the AssumptionAnalysis results.
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
AssumptionPrinterPass(raw_ostream &OS)
Value handle with callbacks on RAUW and destruction.
ImmutablePass class - This class is used to provide information that does not need to be run.
A Module instance is used to store all the information related to an LLVM module.
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
A set of analyses that are preserved following a run of a transformation pass.
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
LLVM Value Representation.
A nullable Value handle that is nullable.
This class implements an extremely fast bulk output stream that can only output to a stream.
This is an optimization pass for GlobalISel generic memory operations.
A CRTP mix-in that provides informational APIs needed for analysis passes.
A special type used by analysis passes to provide an address that identifies that particular analysis...
unsigned Index
contains either ExprResultIdx or the index of the operand bundle containing the knowledge.
An information struct used to provide DenseMap with the various necessary components for a given valu...
A CRTP mix-in to automatically provide informational APIs needed for passes.
static SimpleType getSimplifiedValue(AssumptionCache::ResultElem &Val)
static SimpleType getSimplifiedValue(const AssumptionCache::ResultElem &Val)
Define a template that can be specialized by smart pointers to reflect the fact that they are automat...