LLVM
8.0.1
|
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 () | |
LazyValueInfo (AssumptionCache *AC_, const DataLayout *DL_, TargetLibraryInfo *TLI_, DominatorTree *DT_) | |
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. More... | |
Tristate | getPredicateAt (unsigned Pred, Value *V, Constant *C, Instruction *CxtI) |
Determine whether the specified value comparison with a constant is known to be true or false at the specified instruction (from an assume intrinsic). More... | |
Constant * | getConstant (Value *V, BasicBlock *BB, Instruction *CxtI=nullptr) |
Determine whether the specified value is known to be a constant at the end of the specified block. More... | |
ConstantRange | getConstantRange (Value *V, BasicBlock *BB, Instruction *CxtI=nullptr) |
Return the ConstantRange constraint that is known to hold for the specified value at the end of the specified block. More... | |
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. More... | |
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. More... | |
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. More... | |
void | eraseBlock (BasicBlock *BB) |
Inform the analysis cache that we have erased a block. More... | |
void | printLVI (Function &F, DominatorTree &DTree, raw_ostream &OS) |
Print the Analysis. More... | |
void | disableDT () |
Disables use of the DominatorTree within LVI. More... | |
void | enableDT () |
Enables use of the DominatorTree within LVI. More... | |
void | releaseMemory () |
bool | invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &Inv) |
Handle invalidation events in the new pass manager. More... | |
Friends | |
class | LazyValueInfoWrapperPass |
This pass computes, caches, and vends lazy value constraint information.
Definition at line 32 of file LazyValueInfo.h.
This is used to return true/false/dunno results.
Enumerator | |
---|---|
Unknown | |
False | |
True |
Definition at line 63 of file LazyValueInfo.h.
LazyValueInfo::~LazyValueInfo | ( | ) |
Definition at line 1503 of file LazyValueInfo.cpp.
|
inline |
Definition at line 43 of file LazyValueInfo.h.
|
inline |
Definition at line 44 of file LazyValueInfo.h.
|
inline |
Definition at line 47 of file LazyValueInfo.h.
References Arg.
void LazyValueInfo::disableDT | ( | ) |
Disables use of the DominatorTree within LVI.
Definition at line 1828 of file LazyValueInfo.cpp.
References getImpl().
void LazyValueInfo::enableDT | ( | ) |
Enables use of the DominatorTree within LVI.
Does nothing if the class instance was initialized without a DT pointer.
Definition at line 1833 of file LazyValueInfo.cpp.
References llvm::AnalysisUsage::addRequired(), Arg, llvm::dbgs(), F(), getImpl(), llvm::Value::getName(), llvm::Instruction::getParent(), llvm::BasicBlock::getParent(), llvm::PassRegistry::getPassRegistry(), INITIALIZE_PASS_BEGIN(), INITIALIZE_PASS_DEPENDENCY, llvm::initializeLazyValueInfoPrinterPass(), llvm::SmallPtrSetImpl< PtrType >::insert(), llvm::ValueLatticeElement::isUndefined(), llvm::Value::printAsOperand(), runOnFunction(), llvm::AnalysisUsage::setPreservesAll(), llvm::successors(), and llvm::Value::users().
void LazyValueInfo::eraseBlock | ( | BasicBlock * | BB | ) |
Inform the analysis cache that we have erased a block.
Definition at line 1814 of file LazyValueInfo.cpp.
References llvm::Module::getDataLayout(), getImpl(), and llvm::BasicBlock::getModule().
Referenced by llvm::removeUnreachableBlocks().
Constant * LazyValueInfo::getConstant | ( | Value * | V, |
BasicBlock * | BB, | ||
Instruction * | CxtI = nullptr |
||
) |
Determine whether the specified value is known to be a constant at the end of the specified block.
Return null if not.
Definition at line 1550 of file LazyValueInfo.cpp.
References llvm::ConstantInt::get(), llvm::ValueLatticeElement::getConstant(), llvm::ValueLatticeElement::getConstantRange(), llvm::Value::getContext(), llvm::Module::getDataLayout(), getImpl(), llvm::BasicBlock::getModule(), llvm::ConstantRange::getSingleElement(), llvm::ValueLatticeElement::isConstant(), llvm::ValueLatticeElement::isConstantRange(), and isKnownNonConstant().
Referenced by getConstantAt(), 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 1590 of file LazyValueInfo.cpp.
References llvm::ConstantInt::get(), llvm::ValueLatticeElement::getConstant(), llvm::ValueLatticeElement::getConstantRange(), llvm::Value::getContext(), llvm::Module::getDataLayout(), getImpl(), llvm::BasicBlock::getModule(), llvm::ConstantRange::getSingleElement(), llvm::ValueLatticeElement::isConstant(), and llvm::ValueLatticeElement::isConstantRange().
Referenced by processPHI(), and simplifyCommonValuePhi().
ConstantRange LazyValueInfo::getConstantRange | ( | Value * | V, |
BasicBlock * | BB, | ||
Instruction * | CxtI = nullptr |
||
) |
Return the ConstantRange constraint that is known to hold for the specified value at the end of the specified block.
This may only be called on integer-typed Values.
Definition at line 1570 of file LazyValueInfo.cpp.
References assert(), llvm::ValueLatticeElement::getConstant(), llvm::ValueLatticeElement::getConstantRange(), llvm::Module::getDataLayout(), getImpl(), llvm::Type::getIntegerBitWidth(), llvm::BasicBlock::getModule(), llvm::Value::getType(), llvm::ValueLatticeElement::isConstant(), llvm::ValueLatticeElement::isConstantRange(), llvm::Type::isIntegerTy(), and llvm::ValueLatticeElement::isUndefined().
Referenced by processAdd(), 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 1607 of file LazyValueInfo.cpp.
References assert(), llvm::ValueLatticeElement::getConstant(), llvm::ValueLatticeElement::getConstantRange(), llvm::Module::getDataLayout(), getImpl(), llvm::Type::getIntegerBitWidth(), llvm::BasicBlock::getModule(), llvm::Value::getType(), llvm::ValueLatticeElement::isConstant(), llvm::ValueLatticeElement::isConstantRange(), and llvm::ValueLatticeElement::isUndefined().
LazyValueInfo::Tristate LazyValueInfo::getPredicateAt | ( | unsigned | Pred, |
Value * | V, | ||
Constant * | C, | ||
Instruction * | CxtI | ||
) |
Determine whether the specified value comparison with a constant is known to be true or false at the specified instruction (from an assume intrinsic).
Pred is a CmpInst predicate.
Definition at line 1706 of file LazyValueInfo.cpp.
References False, llvm::Module::getDataLayout(), getImpl(), llvm::Instruction::getModule(), llvm::Instruction::getParent(), getParent(), getPredicateResult(), llvm::Value::getType(), llvm::CmpInst::ICMP_EQ, llvm::CmpInst::ICMP_NE, llvm::isKnownNonZero(), llvm::Constant::isNullValue(), llvm::Type::isPointerTy(), llvm::pred_begin(), llvm::pred_end(), llvm::MipsISD::Ret, llvm::Value::stripPointerCasts(), and True.
Referenced by getConstantAt(), hasPositiveOperands(), processAShr(), processCallSite(), and processCmp().
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 1695 of file LazyValueInfo.cpp.
References llvm::Module::getDataLayout(), getImpl(), llvm::BasicBlock::getModule(), and getPredicateResult().
Referenced by processPHI(), and processSwitch().
bool LazyValueInfo::invalidate | ( | Function & | F, |
const PreservedAnalyses & | PA, | ||
FunctionAnalysisManager::Invalidator & | Inv | ||
) |
Handle invalidation events in the new pass manager.
Definition at line 1513 of file LazyValueInfo.cpp.
References F(), llvm::PreservedAnalyses::getChecker(), and llvm::AnalysisManager< IRUnitT, ExtraArgTs >::Invalidator::invalidate().
|
inline |
Definition at line 51 of file LazyValueInfo.h.
References Arg, and releaseMemory().
void LazyValueInfo::printLVI | ( | Function & | F, |
DominatorTree & | DTree, | ||
raw_ostream & | OS | ||
) |
Print the Analysis.
We pass in the DTree that is required for identifying which basic blocks we can solve/print for, in the LVIPrinter. The DT is optional in LVI, so we need to pass it here as an argument.
Definition at line 1822 of file LazyValueInfo.cpp.
References getImpl().
void LazyValueInfo::releaseMemory | ( | ) |
Definition at line 1505 of file LazyValueInfo.cpp.
References getImpl().
Referenced by operator=(), and llvm::LazyValueInfoWrapperPass::~LazyValueInfoWrapperPass().
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 1806 of file LazyValueInfo.cpp.
References llvm::Module::getDataLayout(), getImpl(), and llvm::BasicBlock::getModule().
|
friend |
Definition at line 33 of file LazyValueInfo.h.