[clang] Remove FiniteMathOnly and use only NoHonorINFs and NoHonorNANs. (PR #97342)

Anastasia Stulova via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 23 09:59:16 PDT 2024


================
@@ -816,6 +816,11 @@ class FPOptions {
     setAllowFPReassociate(LO.AllowFPReassoc);
     setNoHonorNaNs(LO.NoHonorNaNs);
     setNoHonorInfs(LO.NoHonorInfs);
+    // Ensure that if FiniteMathOnly is enabled, NoHonorNaNs and NoHonorInfs are
+    // also enabled. This is because FiniteMathOnly mode assumes no NaNs or Infs
+    // are present in computations.
+    assert((LO.FiniteMathOnly == (LO.NoHonorInfs && LO.NoHonorNaNs)) &&
----------------
AnastasiaStulova wrote:

Btw this option is defined in OpenCL spec so it would be better to keep this at least as a driver option.
https://registry.khronos.org/OpenCL/specs/3.0-unified/html/OpenCL_API.html#optimization-options

I think mapping it to ``NoHonorInfs``, ``NoHonorNaNs`` frontend options seems reasonable.

Can the description of this change be elaborated to describe what the intension is.

Tagging @svenvh for any additional feedback.

 But mapping 

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


More information about the cfe-commits mailing list