[clang] [NFC] Add assertion to ensure FiniteMathOnly is in sync with HonorINFs and HonorNANs. (PR #97342)
Zahira Ammarguellat via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 10 06:47:43 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)) &&
----------------
zahiraam wrote:
There is no need for the assertion then. I suppose `CLFiniteMathOnly` should be removed too, right?
https://github.com/llvm/llvm-project/pull/97342
More information about the cfe-commits
mailing list