[llvm] [ValueTracking] Compute known FPClass from signbit idiom (PR #80740)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 13 11:05:22 PST 2024
================
@@ -4243,6 +4243,19 @@ static void computeKnownFPClassFromCond(const Value *V, Value *Cond,
m_Value(LHS), m_ConstantInt(ClassVal)))) {
FPClassTest Mask = static_cast<FPClassTest>(ClassVal);
KnownFromContext.knownNot(CondIsTrue ? ~Mask : Mask);
+ } else if (match(Cond, m_ICmp(Pred, m_ElementWiseBitCast(m_Value(LHS)),
+ m_APInt(RHS)))) {
+ bool TrueIfSigned;
+ if (Pred == ICmpInst::ICMP_SLT && RHS->isZero())
+ TrueIfSigned = true;
+ else if (Pred == ICmpInst::ICMP_SGT && RHS->isAllOnes())
+ TrueIfSigned = false;
+ else
+ return;
----------------
arsenm wrote:
I vaguely recall seeing a helper for this somewhere but I can't seem to find it
https://github.com/llvm/llvm-project/pull/80740
More information about the llvm-commits
mailing list