|
LLVM
4.0.0
|
A cache of .assume calls within a function. More...
#include <AssumptionCache.h>
Public Member Functions | |
| AssumptionCache (Function &F) | |
| Construct an AssumptionCache from a function by scanning all of its instructions. More... | |
| void | registerAssumption (CallInst *CI) |
| Add an .assume intrinsic to this function's cache. More... | |
| void | updateAffectedValues (CallInst *CI) |
| Update the cache of values being affected by this assumption (i.e. More... | |
| void | clear () |
| Clear the cache of .assume intrinsics for a function. More... | |
| MutableArrayRef< WeakVH > | assumptions () |
| Access the list of assumption handles currently tracked for this function. More... | |
| MutableArrayRef< WeakVH > | assumptionsFor (const Value *V) |
| Access the list of assumptions which affect this value. More... | |
A cache of .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. The cache is also conservatively self-updating so that it will never return incorrect results about a function even as the function is being mutated. However, flushing the cache and rebuilding it (or explicitly updating it) may allow it to discover new assumptions.
Definition at line 39 of file AssumptionCache.h.
|
inline |
Construct an AssumptionCache from a function by scanning all of its instructions.
Definition at line 88 of file AssumptionCache.h.
|
inline |
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.
Definition at line 117 of file AssumptionCache.h.
Referenced by llvm::CodeMetrics::collectEphemeralValues(), llvm::ScalarEvolution::getSignExtendExpr(), llvm::ScalarEvolution::getZeroExtendExpr(), llvm::AssumptionPrinterPass::run(), and llvm::AlignmentFromAssumptionsPass::runImpl().
|
inline |
Access the list of assumptions which affect this value.
Definition at line 124 of file AssumptionCache.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::end(), and llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::find_as().
|
inline |
Clear the cache of .assume intrinsics for a function.
It will be re-scanned the next time it is requested.
Definition at line 103 of file AssumptionCache.h.
References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear().
| void AssumptionCache::registerAssumption | ( | CallInst * | CI | ) |
Add an .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.
Definition at line 156 of file AssumptionCache.cpp.
References assert(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), getParent(), and llvm::PatternMatch::match().
Referenced by AddAlignmentAssumptions(), combineInstructionsOverFunction(), and llvm::UnrollLoop().
| void AssumptionCache::updateAffectedValues | ( | CallInst * | CI | ) |
Update the cache of values being affected by this assumption (i.e.
the values about which this assumption provides information).
Definition at line 39 of file AssumptionCache.cpp.
References A, B, C, llvm::find(), llvm::CallInst::getArgOperand(), I, llvm::CmpInst::ICMP_EQ, llvm::PatternMatch::m_And(), llvm::PatternMatch::m_AShr(), llvm::PatternMatch::m_CombineOr(), llvm::PatternMatch::m_ConstantInt(), llvm::PatternMatch::m_ICmp(), llvm::PatternMatch::m_LShr(), llvm::PatternMatch::m_Not(), llvm::PatternMatch::m_Or(), llvm::PatternMatch::m_Shl(), llvm::PatternMatch::m_Value(), llvm::PatternMatch::m_Xor(), llvm::PatternMatch::match(), and llvm::SmallVectorTemplateBase< T, isPodLike< T >::value >::push_back().
1.8.6