[CodeGen] remove creation of FP cast function attribute

This is the last cleanup step resulting from D115804 .
Now that clang uses intrinsics when we're in the special FP mode,
we don't need a function attribute as an indicator to the backend.
The LLVM part of the change is in D115885.

Differential Revision: https://reviews.llvm.org/D115886
This commit is contained in:
Sanjay Patel 2021-12-19 11:53:56 -05:00
parent 5bb21cea84
commit 1965cc4695
2 changed files with 2 additions and 6 deletions

View File

@ -1831,11 +1831,6 @@ void CodeGenModule::getDefaultFunctionAttributes(StringRef Name,
if (LangOpts.getFPExceptionMode() == LangOptions::FPE_Ignore)
FuncAttrs.addAttribute("no-trapping-math", "true");
// Strict (compliant) code is the default, so only add this attribute to
// indicate that we are trying to workaround a problem case.
if (!CodeGenOpts.StrictFloatCastOverflow)
FuncAttrs.addAttribute("strict-float-cast-overflow", "false");
// TODO: Are these all needed?
// unsafe/inf/nan/nsz are handled by instruction-level FastMathFlags.
if (LangOpts.NoHonorInfs)

View File

@ -1,11 +1,12 @@
// RUN: %clang_cc1 -S -fno-strict-float-cast-overflow %s -emit-llvm -o - | FileCheck %s --check-prefix=NOSTRICT
// When compiling with non-standard semantics, use intrinsics to inhibit the optimizer.
// This used to require a function attribute, so we check that it is NOT here anymore.
// NOSTRICT-LABEL: main
// NOSTRICT: call i32 @llvm.fptosi.sat.i32.f64
// NOSTRICT: call i32 @llvm.fptoui.sat.i32.f64
// NOSTRICT: attributes #0 = {{.*}}"strict-float-cast-overflow"="false"{{.*}}
// NOSTRICT-NOT: strict-float-cast-overflow
// The workaround attribute is not applied by default.