[llvm] [SelectionDAG] Remove `NoNaNsFPMath` in `visitFCmp` (PR #163519)

via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 26 18:35:47 PDT 2025


================
@@ -5869,6 +5869,12 @@ bool SelectionDAG::isKnownNeverNaN(SDValue Op, bool SNaN,
                            ? APInt::getAllOnes(VT.getVectorNumElements())
                            : APInt(1, 1);
 
+  // If all users of this operand is annotated with nnan, we can assume
+  // this operand is not NaN, since nnan also affects inputs.
+  if (llvm::all_of(Op->users(),
+                   [](const SDNode *N) { return N->getFlags().hasNoNaNs(); }))
+    return true;
----------------
paperchalice wrote:

It would break the test `test73_nnan` in `llvm/test/CodeGen/AMDGPU/combine_andor_with_cmps.ll`. But drop it for now is fine.

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


More information about the llvm-commits mailing list