LLVM 20.0.0git
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
llvm::KnownFPClass Struct Reference

#include "llvm/Analysis/ValueTracking.h"

Public Member Functions

bool operator== (KnownFPClass Other) const
 
bool isKnownNever (FPClassTest Mask) const
 Return true if it's known this can never be one of the mask entries.
 
bool isKnownAlways (FPClassTest Mask) const
 
bool isUnknown () const
 
bool isKnownNeverNaN () const
 Return true if it's known this can never be a nan.
 
bool isKnownAlwaysNaN () const
 Return true if it's known this must always be a nan.
 
bool isKnownNeverInfinity () const
 Return true if it's known this can never be an infinity.
 
bool isKnownNeverPosInfinity () const
 Return true if it's known this can never be +infinity.
 
bool isKnownNeverNegInfinity () const
 Return true if it's known this can never be -infinity.
 
bool isKnownNeverSubnormal () const
 Return true if it's known this can never be a subnormal.
 
bool isKnownNeverPosSubnormal () const
 Return true if it's known this can never be a positive subnormal.
 
bool isKnownNeverNegSubnormal () const
 Return true if it's known this can never be a negative subnormal.
 
bool isKnownNeverZero () const
 Return true if it's known this can never be a zero.
 
bool isKnownNeverPosZero () const
 Return true if it's known this can never be a literal positive zero.
 
bool isKnownNeverNegZero () const
 Return true if it's known this can never be a negative zero.
 
bool isKnownNeverLogicalZero (const Function &F, Type *Ty) const
 Return true if it's know this can never be interpreted as a zero.
 
bool isKnownNeverLogicalNegZero (const Function &F, Type *Ty) const
 Return true if it's know this can never be interpreted as a negative zero.
 
bool isKnownNeverLogicalPosZero (const Function &F, Type *Ty) const
 Return true if it's know this can never be interpreted as a positive zero.
 
bool cannotBeOrderedLessThanZero () const
 Return true if we can prove that the analyzed floating-point value is either NaN or never less than -0.0.
 
bool cannotBeOrderedGreaterThanZero () const
 Return true if we can prove that the analyzed floating-point value is either NaN or never greater than -0.0.
 
KnownFPClassoperator|= (const KnownFPClass &RHS)
 
void knownNot (FPClassTest RuleOut)
 
void fneg ()
 
void fabs ()
 
bool signBitIsZeroOrNaN () const
 Return true if the sign bit must be 0, ignoring the sign of nans.
 
void signBitMustBeZero ()
 Assume the sign bit is zero.
 
void signBitMustBeOne ()
 Assume the sign bit is one.
 
void copysign (const KnownFPClass &Sign)
 
void propagateNaN (const KnownFPClass &Src, bool PreserveSign=false)
 
void propagateDenormal (const KnownFPClass &Src, const Function &F, Type *Ty)
 Propagate knowledge from a source value that could be a denormal or zero.
 
void propagateCanonicalizingSrc (const KnownFPClass &Src, const Function &F, Type *Ty)
 Report known classes if Src is evaluated through a potentially canonicalizing operation.
 
void resetAll ()
 

Public Attributes

FPClassTest KnownFPClasses = fcAllFlags
 Floating-point classes the value could be one of.
 
std::optional< boolSignBit
 std::nullopt if the sign bit is unknown, true if the sign bit is definitely set or false if the sign bit is definitely unset.
 

Static Public Attributes

static constexpr FPClassTest OrderedLessThanZeroMask
 
static constexpr FPClassTest OrderedGreaterThanZeroMask
 

Detailed Description

Definition at line 258 of file ValueTracking.h.

Member Function Documentation

◆ cannotBeOrderedGreaterThanZero()

bool llvm::KnownFPClass::cannotBeOrderedGreaterThanZero ( ) const
inline

Return true if we can prove that the analyzed floating-point value is either NaN or never greater than -0.0.

NaN --> true +0 --> true -0 --> true x > +0 --> false x < -0 --> true

Definition at line 371 of file ValueTracking.h.

References isKnownNever(), and OrderedGreaterThanZeroMask.

Referenced by computeKnownFPClass().

◆ cannotBeOrderedLessThanZero()

bool llvm::KnownFPClass::cannotBeOrderedLessThanZero ( ) const
inline

Return true if we can prove that the analyzed floating-point value is either NaN or never less than -0.0.

 NaN --> true
  +0 --> true
  -0 --> true

x > +0 --> true x < -0 --> false

Definition at line 360 of file ValueTracking.h.

References isKnownNever(), and OrderedLessThanZeroMask.

Referenced by llvm::cannotBeOrderedLessThanZero(), computeKnownFPClass(), computeKnownFPClassForFPTrunc(), and simplifyFCmpInst().

◆ copysign()

void llvm::KnownFPClass::copysign ( const KnownFPClass Sign)
inline

◆ fabs()

void llvm::KnownFPClass::fabs ( )
inline

◆ fneg()

void llvm::KnownFPClass::fneg ( )
inline

◆ isKnownAlways()

bool llvm::KnownFPClass::isKnownAlways ( FPClassTest  Mask) const
inline

Definition at line 275 of file ValueTracking.h.

References isKnownNever().

Referenced by isKnownAlwaysNaN().

◆ isKnownAlwaysNaN()

bool llvm::KnownFPClass::isKnownAlwaysNaN ( ) const
inline

Return true if it's known this must always be a nan.

Definition at line 287 of file ValueTracking.h.

References llvm::fcNan, and isKnownAlways().

Referenced by simplifyFCmpInst().

◆ isKnownNever()

bool llvm::KnownFPClass::isKnownNever ( FPClassTest  Mask) const
inline

◆ isKnownNeverInfinity()

bool llvm::KnownFPClass::isKnownNeverInfinity ( ) const
inline

Return true if it's known this can never be an infinity.

Definition at line 290 of file ValueTracking.h.

References llvm::fcInf, and isKnownNever().

Referenced by computeKnownFPClass(), llvm::isKnownNeverInfinity(), and llvm::isKnownNeverInfOrNaN().

◆ isKnownNeverLogicalNegZero()

bool KnownFPClass::isKnownNeverLogicalNegZero ( const Function F,
Type Ty 
) const

Return true if it's know this can never be interpreted as a negative zero.

Definition at line 4238 of file ValueTracking.cpp.

References F, inputDenormalIsIEEEOrPosZero(), isKnownNeverNegSubnormal(), and isKnownNeverNegZero().

Referenced by computeKnownFPClass().

◆ isKnownNeverLogicalPosZero()

bool KnownFPClass::isKnownNeverLogicalPosZero ( const Function F,
Type Ty 
) const

◆ isKnownNeverLogicalZero()

bool KnownFPClass::isKnownNeverLogicalZero ( const Function F,
Type Ty 
) const

Return true if it's know this can never be interpreted as a zero.

This extends isKnownNeverZero to cover the case where the assumed floating-point mode for the function interprets denormals as zero.

Definition at line 4233 of file ValueTracking.cpp.

References F, inputDenormalIsIEEE(), isKnownNeverSubnormal(), and isKnownNeverZero().

Referenced by computeKnownFPClass().

◆ isKnownNeverNaN()

bool llvm::KnownFPClass::isKnownNeverNaN ( ) const
inline

Return true if it's known this can never be a nan.

Definition at line 282 of file ValueTracking.h.

References llvm::fcNan, and isKnownNever().

Referenced by computeKnownFPClass(), llvm::isKnownNeverInfOrNaN(), llvm::isKnownNeverNaN(), and simplifyFCmpInst().

◆ isKnownNeverNegInfinity()

bool llvm::KnownFPClass::isKnownNeverNegInfinity ( ) const
inline

Return true if it's known this can never be -infinity.

Definition at line 300 of file ValueTracking.h.

References llvm::fcNegInf, and isKnownNever().

Referenced by computeKnownFPClass().

◆ isKnownNeverNegSubnormal()

bool llvm::KnownFPClass::isKnownNeverNegSubnormal ( ) const
inline

Return true if it's known this can never be a negative subnormal.

Definition at line 315 of file ValueTracking.h.

References llvm::fcNegSubnormal, and isKnownNever().

Referenced by computeKnownFPClass(), and isKnownNeverLogicalNegZero().

◆ isKnownNeverNegZero()

bool llvm::KnownFPClass::isKnownNeverNegZero ( ) const
inline

Return true if it's known this can never be a negative zero.

This means a literal -0 and does not include denormal inputs implicitly treated as -0.

Definition at line 332 of file ValueTracking.h.

References llvm::fcNegZero, and isKnownNever().

Referenced by llvm::cannotBeNegativeZero(), computeKnownFPClass(), and isKnownNeverLogicalNegZero().

◆ isKnownNeverPosInfinity()

bool llvm::KnownFPClass::isKnownNeverPosInfinity ( ) const
inline

Return true if it's known this can never be +infinity.

Definition at line 295 of file ValueTracking.h.

References llvm::fcPosInf, and isKnownNever().

Referenced by computeKnownFPClass().

◆ isKnownNeverPosSubnormal()

bool llvm::KnownFPClass::isKnownNeverPosSubnormal ( ) const
inline

Return true if it's known this can never be a positive subnormal.

Definition at line 310 of file ValueTracking.h.

References llvm::fcPosSubnormal, and isKnownNever().

Referenced by computeKnownFPClass(), and isKnownNeverLogicalPosZero().

◆ isKnownNeverPosZero()

bool llvm::KnownFPClass::isKnownNeverPosZero ( ) const
inline

Return true if it's known this can never be a literal positive zero.

Definition at line 326 of file ValueTracking.h.

References llvm::fcPosZero, and isKnownNever().

Referenced by computeKnownFPClass(), and isKnownNeverLogicalPosZero().

◆ isKnownNeverSubnormal()

bool llvm::KnownFPClass::isKnownNeverSubnormal ( ) const
inline

Return true if it's known this can never be a subnormal.

Definition at line 305 of file ValueTracking.h.

References llvm::fcSubnormal, and isKnownNever().

Referenced by computeKnownFPClass(), isKnownNeverLogicalPosZero(), and isKnownNeverLogicalZero().

◆ isKnownNeverZero()

bool llvm::KnownFPClass::isKnownNeverZero ( ) const
inline

Return true if it's known this can never be a zero.

This means a literal [+-]0, and does not include denormal inputs implicitly treated as [+-]0.

Definition at line 321 of file ValueTracking.h.

References llvm::fcZero, and isKnownNever().

Referenced by isKnownNeverLogicalZero().

◆ isUnknown()

bool llvm::KnownFPClass::isUnknown ( ) const
inline

Definition at line 277 of file ValueTracking.h.

References llvm::fcAllFlags, KnownFPClasses, and SignBit.

Referenced by computeKnownFPClass().

◆ knownNot()

void llvm::KnownFPClass::knownNot ( FPClassTest  RuleOut)
inline

◆ operator==()

bool llvm::KnownFPClass::operator== ( KnownFPClass  Other) const
inline

Definition at line 266 of file ValueTracking.h.

References KnownFPClasses, llvm::Other, and SignBit.

◆ operator|=()

KnownFPClass & llvm::KnownFPClass::operator|= ( const KnownFPClass RHS)
inline

Definition at line 375 of file ValueTracking.h.

References KnownFPClasses, RHS, and SignBit.

◆ propagateCanonicalizingSrc()

void KnownFPClass::propagateCanonicalizingSrc ( const KnownFPClass Src,
const Function F,
Type Ty 
)

Report known classes if Src is evaluated through a potentially canonicalizing operation.

We can assume signaling nans will not be introduced, but cannot assume a denormal will be flushed under FTZ/DAZ.

This assumes a copy-like operation and will replace any currently known information.

Definition at line 4298 of file ValueTracking.cpp.

References F, propagateDenormal(), and propagateNaN().

Referenced by computeKnownFPClass().

◆ propagateDenormal()

void KnownFPClass::propagateDenormal ( const KnownFPClass Src,
const Function F,
Type Ty 
)

Propagate knowledge from a source value that could be a denormal or zero.

We have to be conservative since output flushing is not guaranteed, so known-never-zero may not hold.

This assumes a copy-like operation and will replace any currently known information.

Definition at line 4269 of file ValueTracking.cpp.

References llvm::DenormalMode::Dynamic, F, llvm::fcNegZero, llvm::fcPosZero, llvm::Type::getFltSemantics(), llvm::DenormalMode::getIEEE(), llvm::DenormalMode::getPositiveZero(), llvm::Type::getScalarType(), KnownFPClasses, and llvm::DenormalMode::PositiveZero.

Referenced by propagateCanonicalizingSrc().

◆ propagateNaN()

void llvm::KnownFPClass::propagateNaN ( const KnownFPClass Src,
bool  PreserveSign = false 
)
inline

◆ resetAll()

void llvm::KnownFPClass::resetAll ( )
inline

Definition at line 483 of file ValueTracking.h.

Referenced by computeKnownFPClass().

◆ signBitIsZeroOrNaN()

bool llvm::KnownFPClass::signBitIsZeroOrNaN ( ) const
inline

Return true if the sign bit must be 0, ignoring the sign of nans.

Definition at line 416 of file ValueTracking.h.

References llvm::fcNegative, and isKnownNever().

◆ signBitMustBeOne()

void llvm::KnownFPClass::signBitMustBeOne ( )
inline

Assume the sign bit is one.

Definition at line 427 of file ValueTracking.h.

References llvm::fcNan, llvm::fcNegative, KnownFPClasses, and SignBit.

Referenced by computeKnownFPClass(), and computeKnownFPClassFromCond().

◆ signBitMustBeZero()

void llvm::KnownFPClass::signBitMustBeZero ( )
inline

Assume the sign bit is zero.

Definition at line 421 of file ValueTracking.h.

References llvm::fcNan, llvm::fcPositive, KnownFPClasses, and SignBit.

Referenced by computeKnownFPClass(), computeKnownFPClassFromCond(), and fabs().

Member Data Documentation

◆ KnownFPClasses

FPClassTest llvm::KnownFPClass::KnownFPClasses = fcAllFlags

◆ OrderedGreaterThanZeroMask

constexpr FPClassTest llvm::KnownFPClass::OrderedGreaterThanZeroMask
staticconstexpr
Initial value:

Definition at line 349 of file ValueTracking.h.

Referenced by cannotBeOrderedGreaterThanZero(), and computeKnownFPClass().

◆ OrderedLessThanZeroMask

constexpr FPClassTest llvm::KnownFPClass::OrderedLessThanZeroMask
staticconstexpr

◆ SignBit

std::optional<bool> llvm::KnownFPClass::SignBit

std::nullopt if the sign bit is unknown, true if the sign bit is definitely set or false if the sign bit is definitely unset.

Definition at line 264 of file ValueTracking.h.

Referenced by computeKnownFPClass(), llvm::computeKnownFPSignBit(), copysign(), fneg(), isUnknown(), knownNot(), operator==(), operator|=(), propagateNaN(), signBitMustBeOne(), signBitMustBeZero(), and simplifyFMAFMul().


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