LLVM: llvm::ValueLatticeElement Class Reference (original) (raw)
This class represents lattice values for constants. More...
#include "[llvm/Analysis/ValueLattice.h](ValueLattice%5F8h%5Fsource.html)"
| Classes | |
|---|---|
| struct | MergeOptions |
| Struct to control some aspects related to merging constant ranges. More... |
This class represents lattice values for constants.
FIXME: This is basically just for bringup, this can be made a lot more rich in the future.
Definition at line 27 of file ValueLattice.h.
| llvm::ValueLatticeElement::ValueLatticeElement ( ) | inline |
|---|
Definition at line 146 of file ValueLattice.h.
Referenced by get(), getCompare(), getNot(), getOverdefined(), getRange(), intersect(), mergeIn(), operator=(), operator=(), ValueLatticeElement(), and ValueLatticeElement().
◆ ~ValueLatticeElement()
| llvm::ValueLatticeElement::~ValueLatticeElement ( ) | inline |
|---|
◆ ValueLatticeElement() [2/3]
◆ ValueLatticeElement() [3/3]
◆ asConstantInteger()
| std::optional< APInt > llvm::ValueLatticeElement::asConstantInteger ( ) const | inline |
|---|
◆ asConstantRange() [1/2]
◆ asConstantRange() [2/2]
◆ get()
◆ getCompare()
true, false or undef constants, or nullptr if the comparison cannot be evaluated.
Definition at line 15 of file ValueLattice.cpp.
References llvm::ConstantFoldCompareInstOperands(), DL, getConstant(), getConstantRange(), llvm::ConstantInt::getFalse(), llvm::CmpInst::getInversePredicate(), getNotConstant(), llvm::ConstantInt::getTrue(), llvm::CmpInst::ICMP_NE, isConstant(), isConstantRange(), llvm::ICmpInst::isEquality(), isNotConstant(), isUndef(), isUnknown(), llvm::Other, and ValueLatticeElement().
◆ getConstant()
| Constant * llvm::ValueLatticeElement::getConstant ( ) const | inline |
|---|
Definition at line 253 of file ValueLattice.h.
References assert(), ConstVal, and isConstant().
Referenced by asConstantInteger(), asConstantRange(), getCompare(), llvm::SCCPInstVisitor::getConstant(), getPredicateResult(), markConstant(), markConstantRange(), mergeIn(), and llvm::operator<<().
◆ getConstantRange()
Returns the constant range for this value.
Use UndefAllowed to exclude non-singleton constant ranges that may also be undef. Note that this function also returns a range if the range may include undef, but only contains a single element. In that case, it can be replaced by a constant.
Definition at line 267 of file ValueLattice.h.
References assert(), isConstantRange(), and Range.
Referenced by asConstantInteger(), asConstantRange(), getCompare(), llvm::SCCPInstVisitor::getConstant(), getPredicateResult(), hasSingleValue(), llvm::hasSingleValue(), llvm::inferAttribute(), intersect(), llvm::SCCPSolver::isConstant(), markConstantRange(), mergeIn(), and llvm::operator<<().
◆ getNot()
◆ getNotConstant()
| Constant * llvm::ValueLatticeElement::getNotConstant ( ) const | inline |
|---|
◆ getNumRangeExtensions()
| unsigned llvm::ValueLatticeElement::getNumRangeExtensions ( ) const | inline |
|---|
◆ getOverdefined()
◆ getRange()
Definition at line 212 of file ValueLattice.h.
References getOverdefined(), llvm::ConstantRange::isEmptySet(), llvm::ConstantRange::isFullSet(), markConstantRange(), markUndef(), and ValueLatticeElement().
Referenced by constantFoldUser(), llvm::SCCPInstVisitor::getArgAttributeVL(), getFromRangeMetadata(), getValueFromICmpCtpop(), getValueFromMetadata(), getValueFromOverflowCondition(), and intersect().
◆ intersect()
Combine two sets of facts about the same value into a single set of facts.
Note that this method is not suitable for merging facts along different paths in a CFG; that's what the mergeIn function is for. This is for merging facts gathered about the same value at the same location through two independent means. Notes:
- This method does not promise to return the most precise possible lattice value implied by A and B. It is allowed to return any lattice element which is at least as strong as either A or B (unless our facts conflict, see below).
- Due to unreachable code, the intersection of two lattice values could be contradictory. If this happens, we return some valid lattice value so as not confuse the rest of LVI. Ideally, we'd always return Undefined, but we do not make this guarantee. TODO: This would be a useful enhancement.
Definition at line 78 of file ValueLattice.cpp.
References getConstantRange(), getRange(), llvm::hasSingleValue(), llvm::ConstantRange::intersectWith(), isConstantRange(), isConstantRangeIncludingUndef(), isOverdefined(), isUnknown(), llvm::Other, Range, and ValueLatticeElement().
Referenced by llvm::LazyValueInfoImpl::getValueAtUse().
◆ isConstant()
| bool llvm::ValueLatticeElement::isConstant ( ) const | inline |
|---|
Definition at line 238 of file ValueLattice.h.
Referenced by asConstantInteger(), asConstantRange(), getCompare(), llvm::SCCPInstVisitor::getConstant(), getConstant(), getPredicateResult(), hasSingleValue(), llvm::hasSingleValue(), llvm::SCCPSolver::isConstant(), markConstant(), markConstantRange(), and mergeIn().
◆ isConstantRange()
| bool llvm::ValueLatticeElement::isConstantRange ( bool UndefAllowed = true) const | inline |
|---|
Returns true if this value is a constant range.
Use UndefAllowed to exclude non-singleton constant ranges that may also be undef. Note that this function also returns true if the range may include undef, but only contains a single element. In that case, it can be replaced by a constant.
Definition at line 247 of file ValueLattice.h.
References Range.
Referenced by asConstantInteger(), asConstantRange(), getCompare(), llvm::SCCPInstVisitor::getConstant(), getConstantRange(), getPredicateResult(), hasSingleValue(), llvm::hasSingleValue(), llvm::inferAttribute(), intersect(), llvm::SCCPSolver::isConstant(), markConstantRange(), mergeIn(), and llvm::operator<<().
◆ isConstantRangeIncludingUndef()
| bool llvm::ValueLatticeElement::isConstantRangeIncludingUndef ( ) const | inline |
|---|
◆ isNotConstant()
| bool llvm::ValueLatticeElement::isNotConstant ( ) const | inline |
|---|
◆ isOverdefined()
| bool llvm::ValueLatticeElement::isOverdefined ( ) const | inline |
|---|
◆ isUndef()
| bool llvm::ValueLatticeElement::isUndef ( ) const | inline |
|---|
◆ isUnknown()
| bool llvm::ValueLatticeElement::isUnknown ( ) const | inline |
|---|
◆ isUnknownOrUndef()
| bool llvm::ValueLatticeElement::isUnknownOrUndef ( ) const | inline |
|---|
◆ markConstant()
| bool llvm::ValueLatticeElement::markConstant ( Constant * V, bool MayIncludeUndef = false ) | inline |
|---|
Definition at line 314 of file ValueLattice.h.
References assert(), ConstVal, llvm::dyn_cast(), getConstant(), llvm::isa(), isConstant(), isUndef(), isUnknown(), markConstantRange(), and markUndef().
Referenced by get(), mergeIn(), and llvm::SCCPInstVisitor::setLatticeValueForSpecializationArguments().
◆ markConstantRange()
Mark the object as constant range with NewR.
If the object is already a constant range, nothing changes if the existing range is equal to NewR and the tag. Otherwise NewR must be a superset of the existing range or the object must be undef. The tag is set to constant_range_including_undef if either the existing value or the new range may include undef.
Definition at line 360 of file ValueLattice.h.
References assert(), llvm::ConstantRange::contains(), getConstant(), getConstantRange(), isConstant(), isConstantRange(), isConstantRangeIncludingUndef(), llvm::ConstantRange::isEmptySet(), llvm::ConstantRange::isFullSet(), isUndef(), isUnknown(), markOverdefined(), and Range.
Referenced by getRange(), markConstant(), markNotConstant(), and mergeIn().
◆ markNotConstant()
| bool llvm::ValueLatticeElement::markNotConstant ( Constant * V) | inline |
|---|
◆ markOverdefined()
| bool llvm::ValueLatticeElement::markOverdefined ( ) | inline |
|---|
◆ markUndef()
| bool llvm::ValueLatticeElement::markUndef ( ) | inline |
|---|
◆ mergeIn()
Updates this object to approximate both this object and RHS.
Returns true if this object has been changed.
Definition at line 400 of file ValueLattice.h.
References assert(), getConstant(), getConstantRange(), getNotConstant(), getType(), isConstant(), isConstantRange(), isNotConstant(), isOverdefined(), isUndef(), isUnknown(), markConstant(), markConstantRange(), markOverdefined(), RHS, llvm::Constant::toConstantRange(), and ValueLatticeElement().
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ setNumRangeExtensions()
| void llvm::ValueLatticeElement::setNumRangeExtensions ( unsigned N) | inline |
|---|
◆ ConstVal
Constant* llvm::ValueLatticeElement::ConstVal
◆ Range
The documentation for this class was generated from the following files:
- include/llvm/Analysis/ValueLattice.h
- lib/Analysis/ValueLattice.cpp