Index: clang/lib/CodeGen/CGCall.cpp =================================================================== --- clang/lib/CodeGen/CGCall.cpp +++ clang/lib/CodeGen/CGCall.cpp @@ -1863,9 +1863,9 @@ if (LangOpts.ApproxFunc) FuncAttrs.addAttribute("approx-func-fp-math", "true"); if ((LangOpts.FastMath || - !LangOpts.FastMath && LangOpts.AllowFPReassoc && LangOpts.AllowRecip && + (!LangOpts.FastMath && LangOpts.AllowFPReassoc && LangOpts.AllowRecip && !LangOpts.FiniteMathOnly && LangOpts.NoSignedZero && - LangOpts.ApproxFunc) && + LangOpts.ApproxFunc)) && LangOpts.getDefaultFPContractMode() != LangOptions::FPModeKind::FPM_Off) FuncAttrs.addAttribute("unsafe-fp-math", "true"); if (CodeGenOpts.SoftFloat)