[llvm] [SelectionDAG] Remove `NoNaNsFPMath` in `visitFCmp` (PR #163519)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 16 02:26:19 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:
We should get fast-math flags from somewhere.
```
def : GCNPat<
(fcanonicalize (vt is_canonicalized:$src)),
(COPY vt:$src)
>;
```
For this pattern, when `fcanonicalize` is called with `nnan` , `isKnownNeverNaN` should return true directly for this case, rather than check all users.
https://github.com/llvm/llvm-project/pull/163519
More information about the llvm-commits
mailing list