[llvm-branch-commits] [llvm] DAG: Handle AssertNoFPClass in computeKnownBits (PR #167289)

Yingwei Zheng via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 10 05:02:41 PST 2025


================
@@ -4121,6 +4121,27 @@ KnownBits SelectionDAG::computeKnownBits(SDValue Op, const APInt &DemandedElts,
     Known.One.clearLowBits(LogOfAlign);
     break;
   }
+  case ISD::AssertNoFPClass: {
+    Known = computeKnownBits(Op.getOperand(0), DemandedElts, Depth + 1);
+
+    FPClassTest NoFPClass =
+        static_cast<FPClassTest>(Op.getConstantOperandVal(1));
+    const FPClassTest NegativeTestMask = fcNan | fcNegative;
+    if ((NoFPClass & NegativeTestMask) == NegativeTestMask) {
+      // Cannot be negative.
+      Known.Zero.setSignBit();
----------------
dtcxzyw wrote:

Use `makeNegative/makeNonNegative`. If there are conflict bits the value is poison.

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


More information about the llvm-branch-commits mailing list