LLVM 22.0.0git
llvm::LazyValueInfo Class Reference

This pass computes, caches, and vends lazy value constraint information. More...

#include "llvm/Analysis/LazyValueInfo.h"

Public Member Functions

 ~LazyValueInfo ()
 LazyValueInfo ()=default
 LazyValueInfo (AssumptionCache *AC_, const DataLayout *DL_)
 LazyValueInfo (LazyValueInfo &&Arg)
LazyValueInfooperator= (LazyValueInfo &&Arg)
ConstantgetPredicateOnEdge (CmpInst::Predicate Pred, Value *V, Constant *C, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI=nullptr)
 Determine whether the specified value comparison with a constant is known to be true or false on the specified CFG edge.
ConstantgetPredicateAt (CmpInst::Predicate Pred, Value *V, Constant *C, Instruction *CxtI, bool UseBlockValue)
 Determine whether the specified value comparison with a constant is known to be true or false at the specified instruction.
ConstantgetPredicateAt (CmpInst::Predicate Pred, Value *LHS, Value *RHS, Instruction *CxtI, bool UseBlockValue)
 Determine whether the specified value comparison is known to be true or false at the specified instruction.
ConstantgetConstant (Value *V, Instruction *CxtI)
 Determine whether the specified value is known to be a constant at the specified instruction.
ConstantRange getConstantRange (Value *V, Instruction *CxtI, bool UndefAllowed)
 Return the ConstantRange constraint that is known to hold for the specified value at the specified instruction.
ConstantRange getConstantRangeAtUse (const Use &U, bool UndefAllowed)
 Return the ConstantRange constraint that is known to hold for the value at a specific use-site.
ConstantgetConstantOnEdge (Value *V, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI=nullptr)
 Determine whether the specified value is known to be a constant on the specified edge.
ConstantRange getConstantRangeOnEdge (Value *V, BasicBlock *FromBB, BasicBlock *ToBB, Instruction *CxtI=nullptr)
 Return the ConstantRage constraint that is known to hold for the specified value on the specified edge.
void threadEdge (BasicBlock *PredBB, BasicBlock *OldSucc, BasicBlock *NewSucc)
 Inform the analysis cache that we have threaded an edge from PredBB to OldSucc to be from PredBB to NewSucc instead.
void forgetValue (Value *V)
 Remove information related to this value from the cache.
void eraseBlock (BasicBlock *BB)
 Inform the analysis cache that we have erased a block.
void clear ()
 Complete flush all previously computed values.
void printLVI (Function &F, DominatorTree &DTree, raw_ostream &OS)
 Print the \LazyValueInfo Analysis.
void releaseMemory ()
bool invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv)
 Handle invalidation events in the new pass manager.

Friends

class LazyValueInfoWrapperPass

Detailed Description

This pass computes, caches, and vends lazy value constraint information.

Definition at line 32 of file LazyValueInfo.h.

Constructor & Destructor Documentation

◆ ~LazyValueInfo()

LazyValueInfo::~LazyValueInfo ( )

Definition at line 1776 of file LazyValueInfo.cpp.

References releaseMemory().

◆ LazyValueInfo() [1/3]

llvm::LazyValueInfo::LazyValueInfo ( )
default

◆ LazyValueInfo() [2/3]

llvm::LazyValueInfo::LazyValueInfo ( AssumptionCache * AC_,
const DataLayout * DL_ )
inline

Definition at line 46 of file LazyValueInfo.h.

◆ LazyValueInfo() [3/3]

llvm::LazyValueInfo::LazyValueInfo ( LazyValueInfo && Arg)
inline

Definition at line 48 of file LazyValueInfo.h.

Member Function Documentation

◆ clear()

void LazyValueInfo::clear ( )

Complete flush all previously computed values.

Definition at line 2088 of file LazyValueInfo.cpp.

◆ eraseBlock()

void LazyValueInfo::eraseBlock ( BasicBlock * BB)

Inform the analysis cache that we have erased a block.

Definition at line 2083 of file LazyValueInfo.cpp.

◆ forgetValue()

void LazyValueInfo::forgetValue ( Value * V)

Remove information related to this value from the cache.

Definition at line 2078 of file LazyValueInfo.cpp.

◆ getConstant()

Constant * LazyValueInfo::getConstant ( Value * V,
Instruction * CxtI )

Determine whether the specified value is known to be a constant at the specified instruction.

Return null if not.

Definition at line 1820 of file LazyValueInfo.cpp.

References llvm::BasicBlock::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::ConstantRange::getSingleElement(), and isKnownNonConstant().

Referenced by getConstantAt(), and processCallSite().

◆ getConstantOnEdge()

Constant * LazyValueInfo::getConstantOnEdge ( Value * V,
BasicBlock * FromBB,
BasicBlock * ToBB,
Instruction * CxtI = nullptr )

Determine whether the specified value is known to be a constant on the specified edge.

Return null if not.

Definition at line 1857 of file LazyValueInfo.cpp.

References llvm::BasicBlock::getModule(), and llvm::ConstantRange::getSingleElement().

Referenced by getValueOnEdge(), processSelect(), and simplifyCommonValuePhi().

◆ getConstantRange()

ConstantRange LazyValueInfo::getConstantRange ( Value * V,
Instruction * CxtI,
bool UndefAllowed )

Return the ConstantRange constraint that is known to hold for the specified value at the specified instruction.

This may only be called on integer-typed Values.

Definition at line 1839 of file LazyValueInfo.cpp.

References llvm::BasicBlock::getModule(), and llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent().

Referenced by runImpl().

◆ getConstantRangeAtUse()

ConstantRange LazyValueInfo::getConstantRangeAtUse ( const Use & U,
bool UndefAllowed )

◆ getConstantRangeOnEdge()

ConstantRange LazyValueInfo::getConstantRangeOnEdge ( Value * V,
BasicBlock * FromBB,
BasicBlock * ToBB,
Instruction * CxtI = nullptr )

Return the ConstantRage constraint that is known to hold for the specified value on the specified edge.

This may be only be called on integer-typed Values.

Definition at line 1874 of file LazyValueInfo.cpp.

References llvm::BasicBlock::getModule().

◆ getPredicateAt() [1/2]

Constant * LazyValueInfo::getPredicateAt ( CmpInst::Predicate Pred,
Value * LHS,
Value * RHS,
Instruction * CxtI,
bool UseBlockValue )

Determine whether the specified value comparison is known to be true or false at the specified instruction.

While this takes two Value's, it still requires that one of them is a constant. Pred is a CmpInst predicate. If UseBlockValue is true, the block value is also taken into account.

Definition at line 2045 of file LazyValueInfo.cpp.

References llvm::CallingConv::C, llvm::dyn_cast(), llvm::Instruction::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), getPredicateAt(), llvm::CmpInst::getSwappedPredicate(), and llvm::CmpInst::makeCmpResultType().

◆ getPredicateAt() [2/2]

Constant * LazyValueInfo::getPredicateAt ( CmpInst::Predicate Pred,
Value * V,
Constant * C,
Instruction * CxtI,
bool UseBlockValue )

◆ getPredicateOnEdge()

Constant * LazyValueInfo::getPredicateOnEdge ( CmpInst::Predicate Pred,
Value * V,
Constant * C,
BasicBlock * FromBB,
BasicBlock * ToBB,
Instruction * CxtI = nullptr )

Determine whether the specified value comparison with a constant is known to be true or false on the specified CFG edge.

Pred is a CmpInst predicate.

Definition at line 1927 of file LazyValueInfo.cpp.

References llvm::CallingConv::C, llvm::BasicBlock::getModule(), and getPredicateResult().

Referenced by getPredicateAt(), and getValueOnEdge().

◆ invalidate()

bool LazyValueInfo::invalidate ( Function & F,
const PreservedAnalyses & PA,
FunctionAnalysisManager::Invalidator & Inv )

Handle invalidation events in the new pass manager.

Definition at line 1786 of file LazyValueInfo.cpp.

References F, and llvm::PreservedAnalyses::getChecker().

◆ operator=()

LazyValueInfo & llvm::LazyValueInfo::operator= ( LazyValueInfo && Arg)
inline

Definition at line 52 of file LazyValueInfo.h.

References releaseMemory().

◆ printLVI()

void LazyValueInfo::printLVI ( Function & F,
DominatorTree & DTree,
raw_ostream & OS )

Print the \LazyValueInfo Analysis.

We pass in the DTree that is required for identifying which basic blocks we can solve/print for, in the LVIPrinter.

Definition at line 2093 of file LazyValueInfo.cpp.

References F.

◆ releaseMemory()

void LazyValueInfo::releaseMemory ( )

Definition at line 1778 of file LazyValueInfo.cpp.

Referenced by operator=(), and ~LazyValueInfo().

◆ threadEdge()

void LazyValueInfo::threadEdge ( BasicBlock * PredBB,
BasicBlock * OldSucc,
BasicBlock * NewSucc )

Inform the analysis cache that we have threaded an edge from PredBB to OldSucc to be from PredBB to NewSucc instead.

Definition at line 2072 of file LazyValueInfo.cpp.

◆ LazyValueInfoWrapperPass

friend class LazyValueInfoWrapperPass
friend

Definition at line 33 of file LazyValueInfo.h.

References LazyValueInfoWrapperPass.

Referenced by LazyValueInfoWrapperPass.


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