[llvm] [NVPTX] Consistently check fast-math flags when lowering fsqrt (PR #143776)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 11 17:13:28 PDT 2025


================
@@ -1134,7 +1143,8 @@ SDValue NVPTXTargetLowering::getSqrtEstimate(SDValue Operand, SelectionDAG &DAG,
                                              bool &UseOneConst,
                                              bool Reciprocal) const {
   if (!(Enabled == ReciprocalEstimate::Enabled ||
-        (Enabled == ReciprocalEstimate::Unspecified && !usePrecSqrtF32())))
+        (Enabled == ReciprocalEstimate::Unspecified &&
+         !usePrecSqrtF32(DAG.getMachineFunction()))))
----------------
Artem-B wrote:

This condition is a bit of a pain to read.

AFAICT, it all boils down to just:
```
if (Enabled == ReciprocalEstimate::Disabled || usePrecSqrtF32(DAG.getMachineFunction())
```

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


More information about the llvm-commits mailing list