LLVM 17.0.0git
|
This pass computes, caches, and vends lazy value constraint information. More...
#include "llvm/Analysis/LazyValueInfo.h"
Public Types | |
enum | Tristate { Unknown = -1 , False = 0 , True = 1 } |
This is used to return true/false/dunno results. More... | |
Public Member Functions | |
~LazyValueInfo () | |
LazyValueInfo ()=default | |
LazyValueInfo (AssumptionCache *AC_, const DataLayout *DL_, TargetLibraryInfo *TLI_) | |
LazyValueInfo (LazyValueInfo &&Arg) | |
LazyValueInfo & | operator= (LazyValueInfo &&Arg) |
Tristate | getPredicateOnEdge (unsigned 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. | |
Tristate | getPredicateAt (unsigned 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. | |
Tristate | getPredicateAt (unsigned 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=true) |
Return the ConstantRange constraint that is known to hold for the specified value at the specified instruction. | |
ConstantRange | getConstantRangeAtUse (const Use &U, bool UndefAllowed=true) |
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 | eraseBlock (BasicBlock *BB) |
Inform the analysis cache that we have erased a block. | |
void | clear (const Module *M) |
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 31 of file LazyValueInfo.h.
This is used to return true/false/dunno results.
Enumerator | |
---|---|
Unknown | |
False | |
True |
Definition at line 60 of file LazyValueInfo.h.
LazyValueInfo::~LazyValueInfo | ( | ) |
Definition at line 1577 of file LazyValueInfo.cpp.
References releaseMemory().
|
default |
|
inline |
Definition at line 42 of file LazyValueInfo.h.
|
inline |
Definition at line 45 of file LazyValueInfo.h.
References Arg.
Complete flush all previously computed values.
Definition at line 1978 of file LazyValueInfo.cpp.
References getImpl().
void LazyValueInfo::eraseBlock | ( | BasicBlock * | BB | ) |
Inform the analysis cache that we have erased a block.
Definition at line 1972 of file LazyValueInfo.cpp.
References getImpl(), and llvm::BasicBlock::getModule().
Referenced by llvm::JumpThreadingPass::maybeMergeBasicBlockIntoOnlyPred(), and llvm::JumpThreadingPass::runImpl().
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 1622 of file LazyValueInfo.cpp.
References llvm::ConstantInt::get(), getImpl(), llvm::BasicBlock::getModule(), llvm::Instruction::getParent(), llvm::ConstantRange::getSingleElement(), and isKnownNonConstant().
Referenced by llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), getConstantAt(), processCallSite(), processMemAccess(), and processSelect().
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 1708 of file LazyValueInfo.cpp.
References llvm::ConstantInt::get(), getImpl(), llvm::BasicBlock::getModule(), and llvm::ConstantRange::getSingleElement().
Referenced by llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl(), llvm::JumpThreadingPass::evaluateOnPredecessorEdge(), getValueOnEdge(), and simplifyCommonValuePhi().
ConstantRange LazyValueInfo::getConstantRange | ( | Value * | V, |
Instruction * | CxtI, | ||
bool | UndefAllowed = true |
||
) |
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 1641 of file LazyValueInfo.cpp.
References assert(), getImpl(), llvm::BasicBlock::getModule(), and llvm::Instruction::getParent().
Referenced by getConstantRangeAtUse(), processBinOp(), and processICmp().
ConstantRange LazyValueInfo::getConstantRangeAtUse | ( | const Use & | U, |
bool | UndefAllowed = true |
||
) |
Return the ConstantRange constraint that is known to hold for the value at a specific use-site.
Definition at line 1659 of file LazyValueInfo.cpp.
References getConstantRange(), getEdgeValueLocal(), getValueFromCondition(), I, llvm::ConstantRange::intersectWith(), llvm::isGuaranteedNotToBeUndefOrPoison(), llvm::isSafeToSpeculativelyExecute(), PHI, SI, and llvm::Value::use_begin().
Referenced by processAnd(), processAShr(), processSDivOrSRem(), processSExt(), 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 1725 of file LazyValueInfo.cpp.
References assert(), getImpl(), and llvm::BasicBlock::getModule().
Referenced by llvm::JumpThreadingPass::computeValueKnownInPredecessorsImpl().
LazyValueInfo::Tristate LazyValueInfo::getPredicateAt | ( | unsigned | 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 1928 of file LazyValueInfo.cpp.
References llvm::CallingConv::C, False, getImpl(), llvm::Instruction::getModule(), llvm::Instruction::getParent(), getPredicateAt(), llvm::CmpInst::getSwappedPredicate(), llvm::Value::getType(), LHS, llvm::CmpInst::makeCmpResultType(), P, RHS, True, and Unknown.
LazyValueInfo::Tristate LazyValueInfo::getPredicateAt | ( | unsigned | 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 1824 of file LazyValueInfo.cpp.
References llvm::CallingConv::C, DL, False, getImpl(), llvm::Instruction::getModule(), llvm::Instruction::getParent(), getPredicateOnEdge(), getPredicateResult(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::isKnownNonZero(), PHI, llvm::pred_begin(), llvm::pred_end(), True, and Unknown.
Referenced by constantFoldCmp(), getConstantAt(), getPredicateAt(), processAbsIntrinsic(), llvm::JumpThreadingPass::processBlock(), processCallSite(), processMinMaxIntrinsic(), and processSwitch().
LazyValueInfo::Tristate LazyValueInfo::getPredicateOnEdge | ( | unsigned | 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 1813 of file LazyValueInfo.cpp.
References llvm::CallingConv::C, getImpl(), llvm::BasicBlock::getModule(), and getPredicateResult().
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 1587 of file LazyValueInfo.cpp.
References llvm::PreservedAnalyses::getChecker().
|
inline |
Definition at line 49 of file LazyValueInfo.h.
References Arg, 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 1984 of file LazyValueInfo.cpp.
void LazyValueInfo::releaseMemory | ( | ) |
Definition at line 1579 of file LazyValueInfo.cpp.
References getImpl().
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 1964 of file LazyValueInfo.cpp.
References getImpl(), and llvm::BasicBlock::getModule().
Referenced by llvm::JumpThreadingPass::threadEdge().
|
friend |
Definition at line 32 of file LazyValueInfo.h.