LLVM  6.0.0svn
Classes | Public Member Functions | List of all members
llvm::AssumptionCache Class Reference

A cache of .assume calls within a function. More...

#include "llvm/Analysis/AssumptionCache.h"

Public Member Functions

 AssumptionCache (Function &F)
 Construct an AssumptionCache from a function by scanning all of its instructions. More...
 
bool invalidate (Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
 This cache is designed to be self-updating and so it should never be invalidated. 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< WeakTrackingVHassumptions ()
 Access the list of assumption handles currently tracked for this function. More...
 
MutableArrayRef< WeakTrackingVHassumptionsFor (const Value *V)
 Access the list of assumptions which affect this value. More...
 

Detailed Description

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. Passes that create new assumptions are required to call registerAssumption() to register any new .assume calls that they create. Deletions of .assume calls do not require special handling.

Definition at line 42 of file AssumptionCache.h.

Constructor & Destructor Documentation

◆ AssumptionCache()

llvm::AssumptionCache::AssumptionCache ( Function F)
inline

Construct an AssumptionCache from a function by scanning all of its instructions.

Definition at line 92 of file AssumptionCache.h.

Referenced by llvm::AssumptionAnalysis::run().

Member Function Documentation

◆ assumptions()

MutableArrayRef<WeakTrackingVH> llvm::AssumptionCache::assumptions ( )
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 128 of file AssumptionCache.h.

Referenced by llvm::CodeMetrics::collectEphemeralValues(), llvm::AssumptionPrinterPass::run(), and llvm::AlignmentFromAssumptionsPass::runImpl().

◆ assumptionsFor()

MutableArrayRef<WeakTrackingVH> llvm::AssumptionCache::assumptionsFor ( const Value V)
inline

◆ clear()

void llvm::AssumptionCache::clear ( )
inline

Clear the cache of .assume intrinsics for a function.

It will be re-scanned the next time it is requested.

Definition at line 114 of file AssumptionCache.h.

References llvm::DenseMapBase< DerivedT, KeyT, ValueT, KeyInfoT, BucketT >::clear(), and llvm::SmallVectorImpl< T >::clear().

◆ invalidate()

bool llvm::AssumptionCache::invalidate ( Function ,
const PreservedAnalyses ,
FunctionAnalysisManager::Invalidator  
)
inline

This cache is designed to be self-updating and so it should never be invalidated.

Definition at line 96 of file AssumptionCache.h.

References registerAssumption(), and updateAffectedValues().

◆ registerAssumption()

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 169 of file AssumptionCache.cpp.

References assert(), F(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), getParent(), and llvm::PatternMatch::match().

Referenced by AddAlignmentAssumptions(), addAssumeNonNull(), CloneLoop(), combineInstructionsOverFunction(), FoldCondBranchOnPHI(), invalidate(), llvm::InnerLoopVectorizer::scalarizeInstruction(), and llvm::UnrollLoop().

◆ updateAffectedValues()

void AssumptionCache::updateAffectedValues ( CallInst CI)

The documentation for this class was generated from the following files: