LLVM 20.0.0git
|
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) | |
LazyValueInfo & | operator= (LazyValueInfo &&Arg) |
Constant * | 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. | |
Constant * | getPredicateAt (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. | |
Constant * | 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. | |
Constant * | getConstant (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. | |
Constant * | 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. | |
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 |
This pass computes, caches, and vends lazy value constraint information.
Definition at line 32 of file LazyValueInfo.h.
LazyValueInfo::~LazyValueInfo | ( | ) |
Definition at line 1696 of file LazyValueInfo.cpp.
References releaseMemory().
|
default |
|
inline |
Definition at line 46 of file LazyValueInfo.h.
|
inline |
Definition at line 48 of file LazyValueInfo.h.
void LazyValueInfo::clear | ( | ) |
Complete flush all previously computed values.
Definition at line 2008 of file LazyValueInfo.cpp.
void LazyValueInfo::eraseBlock | ( | BasicBlock * | BB | ) |
Inform the analysis cache that we have erased a block.
Definition at line 2003 of file LazyValueInfo.cpp.
Referenced by llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), and llvm::JumpThreadingPass::runImpl().
void LazyValueInfo::forgetValue | ( | Value * | V | ) |
Remove information related to this value from the cache.
Definition at line 1998 of file LazyValueInfo.cpp.
Referenced by llvm::JumpThreadingPass::simplifyPartiallyRedundantLoad().
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 1740 of file LazyValueInfo.cpp.
References llvm::BasicBlock::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::ConstantRange::getSingleElement(), llvm::LazyValueInfoImpl::getValueInBlock(), and isKnownNonConstant().
Referenced by llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), getConstantAt(), and processCallSite().
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 1777 of file LazyValueInfo.cpp.
References llvm::BasicBlock::getModule(), llvm::ConstantRange::getSingleElement(), and llvm::LazyValueInfoImpl::getValueOnEdge().
Referenced by llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), llvm::JumpThreadingPass::evaluateOnPredecessorEdge(), getValueOnEdge(), processSelect(), and simplifyCommonValuePhi().
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 1759 of file LazyValueInfo.cpp.
References llvm::BasicBlock::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), and llvm::LazyValueInfoImpl::getValueInBlock().
Referenced by runImpl().
ConstantRange LazyValueInfo::getConstantRangeAtUse | ( | const Use & | U, |
bool | UndefAllowed | ||
) |
Return the ConstantRange constraint that is known to hold for the value at a specific use-site.
Definition at line 1767 of file LazyValueInfo.cpp.
References llvm::LazyValueInfoImpl::getValueAtUse().
Referenced by processAbsIntrinsic(), processAnd(), processAShr(), processBinOp(), processCmpIntrinsic(), processICmp(), processMinMaxIntrinsic(), processPossibleNonNeg(), processSDivOrSRem(), processSExt(), processSIToFP(), processSwitch(), processUDivOrURem(), and willNotOverflow().
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 1794 of file LazyValueInfo.cpp.
References llvm::BasicBlock::getModule(), and llvm::LazyValueInfoImpl::getValueOnEdge().
Referenced by llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl().
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 1965 of file LazyValueInfo.cpp.
References llvm::CallingConv::C, llvm::Instruction::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), getPredicateAt(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), llvm::LazyValueInfoImpl::getValueInBlock(), LHS, llvm::CmpInst::makeCmpResultType(), and RHS.
Constant * LazyValueInfo::getPredicateAt | ( | 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.
Pred
is a CmpInst predicate. If UseBlockValue
is true, the block value is also taken into account.
Definition at line 1858 of file LazyValueInfo.cpp.
References llvm::CallingConv::C, DL, llvm::ConstantInt::getFalse(), llvm::Instruction::getModule(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), getPredicateOnEdge(), getPredicateResult(), llvm::ConstantInt::getTrue(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::isKnownNonZero(), llvm::CmpInst::makeCmpResultType(), PHI, llvm::pred_begin(), and llvm::pred_end().
Referenced by constantFoldCmp(), getConstantAt(), getPredicateAt(), llvm::JumpThreadingPass::processBlock(), processCallSite(), and processSwitch().
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 1847 of file LazyValueInfo.cpp.
References llvm::CallingConv::C, llvm::BasicBlock::getModule(), getPredicateResult(), and llvm::LazyValueInfoImpl::getValueOnEdge().
Referenced by llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), getPredicateAt(), getValueOnEdge(), and llvm::JumpThreadingPass::tryToUnfoldSelect().
bool LazyValueInfo::invalidate | ( | Function & | F, |
const PreservedAnalyses & | PA, | ||
FunctionAnalysisManager::Invalidator & | Inv | ||
) |
Handle invalidation events in the new pass manager.
Definition at line 1706 of file LazyValueInfo.cpp.
References llvm::PreservedAnalyses::getChecker().
|
inline |
Definition at line 52 of file LazyValueInfo.h.
References DL, and releaseMemory().
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 2013 of file LazyValueInfo.cpp.
void LazyValueInfo::releaseMemory | ( | ) |
Definition at line 1698 of file LazyValueInfo.cpp.
Referenced by operator=(), llvm::LazyValueInfoWrapperPass::releaseMemory(), and ~LazyValueInfo().
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 1992 of file LazyValueInfo.cpp.
Referenced by llvm::JumpThreadingPass::threadEdge().
|
friend |
Definition at line 33 of file LazyValueInfo.h.