[llvm] CodeGen: Add ISD::AssertNoFPClass (PR #135946)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 21 02:15:25 PDT 2025


================
@@ -5760,6 +5760,17 @@ bool SelectionDAG::isKnownNeverNaN(SDValue Op, const APInt &DemandedElts,
         return false;
     return true;
   }
+  case ISD::AssertNoFPClass: {
+    SDValue SDNoFPClass = Op.getOperand(1);
+    assert(isa<ConstantSDNode>(SDNoFPClass) && "NoFPClass is not Constant");
+    FPClassTest NoFPClass = static_cast<FPClassTest>(
+        dyn_cast<ConstantSDNode>(SDNoFPClass)->getZExtValue());
+    if (NoFPClass & fcNan)
+      return true;
----------------
arsenm wrote:

```suggestion
    if ((NoFPClass & fcNan) == fcNan)
      return true;
```

Need to defend against the case where only one of the bits is set 

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


More information about the llvm-commits mailing list