LLVM 20.0.0git
|
#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. | |
KnownFPClass & | operator|= (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< bool > | 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. | |
Static Public Attributes | |
static constexpr FPClassTest | OrderedLessThanZeroMask |
static constexpr FPClassTest | OrderedGreaterThanZeroMask |
Definition at line 258 of file ValueTracking.h.
|
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().
|
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().
|
inline |
Definition at line 432 of file ValueTracking.h.
References llvm::fcInf, llvm::fcNan, llvm::fcNegative, llvm::fcNormal, llvm::fcPositive, llvm::fcSubnormal, llvm::fcZero, isKnownNever(), KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 399 of file ValueTracking.h.
References llvm::fcNegInf, llvm::fcNegNormal, llvm::fcNegSubnormal, llvm::fcNegZero, llvm::fcPosInf, llvm::fcPosNormal, llvm::fcPosSubnormal, llvm::fcPosZero, KnownFPClasses, and signBitMustBeZero().
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 393 of file ValueTracking.h.
References llvm::fneg(), KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
inline |
Definition at line 275 of file ValueTracking.h.
References isKnownNever().
Referenced by isKnownAlwaysNaN().
|
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().
|
inline |
Return true if it's known this can never be one of the mask entries.
Definition at line 271 of file ValueTracking.h.
References llvm::fcNone, and KnownFPClasses.
Referenced by cannotBeOrderedGreaterThanZero(), cannotBeOrderedLessThanZero(), computeKnownFPClass(), copysign(), foldFPtoI(), isKnownAlways(), isKnownNeverInfinity(), isKnownNeverNaN(), isKnownNeverNegInfinity(), isKnownNeverNegSubnormal(), isKnownNeverNegZero(), isKnownNeverPosInfinity(), isKnownNeverPosSubnormal(), isKnownNeverPosZero(), isKnownNeverSubnormal(), isKnownNeverZero(), knownNot(), signBitIsZeroOrNaN(), llvm::InstCombinerImpl::SimplifyDemandedUseFPClass(), and simplifyFMAFMul().
|
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().
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().
Return true if it's know this can never be interpreted as a positive zero.
Definition at line 4244 of file ValueTracking.cpp.
References F, llvm::Type::getFltSemantics(), llvm::Type::getScalarType(), llvm::DenormalMode::IEEE, isKnownNeverPosSubnormal(), isKnownNeverPosZero(), isKnownNeverSubnormal(), llvm_unreachable, llvm::DenormalMode::PositiveZero, and llvm::DenormalMode::PreserveSign.
Referenced by computeKnownFPClass().
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
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().
|
inline |
Definition at line 277 of file ValueTracking.h.
References llvm::fcAllFlags, KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass().
|
inline |
Definition at line 383 of file ValueTracking.h.
References llvm::fcNan, llvm::fcNegative, llvm::fcPositive, isKnownNever(), KnownFPClasses, and SignBit.
Referenced by computeKnownFPClass(), computeKnownFPClassForFPTrunc(), computeKnownFPClassFromCond(), and propagateNaN().
|
inline |
Definition at line 266 of file ValueTracking.h.
References KnownFPClasses, llvm::Other, and SignBit.
|
inline |
Definition at line 375 of file ValueTracking.h.
References KnownFPClasses, RHS, and SignBit.
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().
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().
|
inline |
Definition at line 457 of file ValueTracking.h.
References llvm::fcNan, llvm::fcSNan, knownNot(), and SignBit.
Referenced by computeKnownFPClass(), computeKnownFPClassForFPTrunc(), and propagateCanonicalizingSrc().
|
inline |
Definition at line 483 of file ValueTracking.h.
Referenced by computeKnownFPClass().
|
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().
|
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().
|
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().
FPClassTest llvm::KnownFPClass::KnownFPClasses = fcAllFlags |
Floating-point classes the value could be one of.
Definition at line 260 of file ValueTracking.h.
Referenced by computeKnownFPClass(), copysign(), fabs(), fneg(), isKnownNever(), isUnknown(), knownNot(), operator==(), operator|=(), propagateDenormal(), signBitMustBeOne(), signBitMustBeZero(), and llvm::InstCombinerImpl::SimplifyDemandedUseFPClass().
|
staticconstexpr |
Definition at line 349 of file ValueTracking.h.
Referenced by cannotBeOrderedGreaterThanZero(), and computeKnownFPClass().
|
staticconstexpr |
Definition at line 347 of file ValueTracking.h.
Referenced by cannotBeOrderedLessThanZero(), llvm::cannotBeOrderedLessThanZero(), computeKnownFPClass(), computeKnownFPClassForFPTrunc(), and simplifyFCmpInst().
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().