[clang] 1965cc4 - [CodeGen] remove creation of FP cast function attribute
Sanjay Patel via cfe-commits
cfe-commits at lists.llvm.org
Sun Dec 19 08:58:04 PST 2021
Author: Sanjay Patel
Date: 2021-12-19T11:55:00-05:00
New Revision: 1965cc469539979d66c6a7f9d1c73000a795f8f0
URL: https://github.com/llvm/llvm-project/commit/1965cc469539979d66c6a7f9d1c73000a795f8f0
DIFF: https://github.com/llvm/llvm-project/commit/1965cc469539979d66c6a7f9d1c73000a795f8f0.diff
LOG: [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
Added:
Modified:
clang/lib/CodeGen/CGCall.cpp
clang/test/CodeGen/no-junk-ftrunc.c
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index e4526ff30bdd8..b202326cf7575 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -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)
diff --git a/clang/test/CodeGen/no-junk-ftrunc.c b/clang/test/CodeGen/no-junk-ftrunc.c
index 6ae6d30fca434..62491fbfa7cd4 100644
--- a/clang/test/CodeGen/no-junk-ftrunc.c
+++ b/clang/test/CodeGen/no-junk-ftrunc.c
@@ -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.
More information about the cfe-commits
mailing list