[llvm] ValueTracking: Teach computeKnownFPClass to look at bitcast + integer max (PR #184073)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 4 10:01:36 PST 2026


================
@@ -5971,8 +5971,28 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
         !Src->getType()->isIntOrIntVectorTy())
       break;
 
-    const Type *Ty = Op->getType()->getScalarType();
-    KnownBits Bits(Ty->getScalarSizeInBits());
+    const Type *Ty = Op->getType();
+
+    Value *CastLHS, *CastRHS;
+
+    // Match bitcast(umax(bitcast(a), bitcast(b)))
+    if (match(Src, m_c_MaxOrMin(m_BitCast(m_Value(CastLHS)),
----------------
dtcxzyw wrote:

Use `m_ElementwiseBitCast` and add a negative test with bitcast float to <32 x i1>.

https://github.com/llvm/llvm-project/pull/184073


More information about the llvm-commits mailing list