LLVM  14.0.0git
Public Types | Public Member Functions | Friends | List of all members
llvm::LazyValueInfo Class Reference

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_)
 
 LazyValueInfo (LazyValueInfo &&Arg)
 
LazyValueInfooperator= (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, bool UseBlockValue)
 Determine whether the specified value comparison with a constant is known to be true or false at the specified instruction. More...
 
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. More...
 
ConstantgetConstant (Value *V, Instruction *CxtI)
 Determine whether the specified value is known to be a constant at the specified instruction. More...
 
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. More...
 
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. 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 \LazyValueInfo Analysis. 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
 

Detailed Description

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

Definition at line 31 of file LazyValueInfo.h.

Member Enumeration Documentation

◆ Tristate

This is used to return true/false/dunno results.

Enumerator
Unknown 
False 
True 

Definition at line 60 of file LazyValueInfo.h.

Constructor & Destructor Documentation

◆ ~LazyValueInfo()

LazyValueInfo::~LazyValueInfo ( )

Definition at line 1537 of file LazyValueInfo.cpp.

References releaseMemory().

◆ LazyValueInfo() [1/3]

llvm::LazyValueInfo::LazyValueInfo ( )
inline

Definition at line 41 of file LazyValueInfo.h.

◆ LazyValueInfo() [2/3]

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

Definition at line 42 of file LazyValueInfo.h.

◆ LazyValueInfo() [3/3]

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

Definition at line 45 of file LazyValueInfo.h.

References Arg.

Member Function Documentation

◆ eraseBlock()

void LazyValueInfo::eraseBlock ( BasicBlock BB)

Inform the analysis cache that we have erased a block.

Definition at line 1867 of file LazyValueInfo.cpp.

References BB, and getImpl().

◆ 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 1582 of file LazyValueInfo.cpp.

References BB, llvm::ConstantInt::get(), llvm::Value::getContext(), getImpl(), llvm::Instruction::getParent(), llvm::ConstantRange::getSingleElement(), and isKnownNonConstant().

Referenced by getConstantAt(), processCallSite(), processMemAccess(), and processSelect().

◆ 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 1621 of file LazyValueInfo.cpp.

References llvm::ConstantInt::get(), llvm::Value::getContext(), getImpl(), llvm::BasicBlock::getModule(), llvm::ConstantRange::getSingleElement(), and M.

Referenced by processPHI(), and simplifyCommonValuePhi().

◆ getConstantRange()

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 1601 of file LazyValueInfo.cpp.

References assert(), BB, getImpl(), llvm::Type::getIntegerBitWidth(), llvm::Instruction::getParent(), llvm::Value::getType(), and llvm::Type::isIntegerTy().

Referenced by narrowSDivOrSRem(), processAnd(), processBinOp(), processUDivOrURem(), and willNotOverflow().

◆ 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 1638 of file LazyValueInfo.cpp.

References assert(), getImpl(), llvm::Type::getIntegerBitWidth(), llvm::BasicBlock::getModule(), llvm::Value::getType(), and M.

◆ getPredicateAt() [1/2]

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 1841 of file LazyValueInfo.cpp.

References getPredicateAt(), llvm::CmpInst::getSwappedPredicate(), P, and Unknown.

◆ getPredicateAt() [2/2]

LazyValueInfo::Tristate LazyValueInfo::getPredicateAt ( unsigned  Pred,
Value V,
Constant C,
Instruction CxtI,
bool  UseBlockValue 
)

◆ getPredicateOnEdge()

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 1726 of file LazyValueInfo.cpp.

References getImpl(), llvm::BasicBlock::getModule(), getPredicateResult(), and M.

Referenced by getPredicateAt(), and processPHI().

◆ invalidate()

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

Handle invalidation events in the new pass manager.

Definition at line 1547 of file LazyValueInfo.cpp.

References llvm::PreservedAnalyses::getChecker().

◆ operator=()

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

Definition at line 49 of file LazyValueInfo.h.

References Arg, DL, and 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 1874 of file LazyValueInfo.cpp.

References F, and getImpl().

◆ releaseMemory()

void LazyValueInfo::releaseMemory ( )

◆ 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 1859 of file LazyValueInfo.cpp.

References getImpl(), and llvm::BasicBlock::getModule().

Friends And Related Function Documentation

◆ LazyValueInfoWrapperPass

friend class LazyValueInfoWrapperPass
friend

Definition at line 32 of file LazyValueInfo.h.


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