[clang] e94c171 - [clang][Driver] recognize `-ffp-contract=fast-honor-pragmas`
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 24 16:51:11 PDT 2023
Author: Yaxun (Sam) Liu
Date: 2023-08-24T19:50:10-04:00
New Revision: e94c171ddb036e9672681d74725069352dd04d0e
URL: https://github.com/llvm/llvm-project/commit/e94c171ddb036e9672681d74725069352dd04d0e
DIFF: https://github.com/llvm/llvm-project/commit/e94c171ddb036e9672681d74725069352dd04d0e.diff
LOG: [clang][Driver] recognize `-ffp-contract=fast-honor-pragmas`
-ffp-contract=fast-honor-pragmas is a valid option recognized
by clang -cc1 but it is missed by clang driver.
Reviewed by: Matt Arsenault
Differential Revision: https://reviews.llvm.org/D145648
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/fp-contract.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index aaff62e5661a95..488838b1ff4bb7 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2955,7 +2955,8 @@ static void RenderFloatingPointOptions(const ToolChain &TC, const Driver &D,
// -ffp-model=precise sets PreciseFPModel to on and Val to
// "precise". FPContract is set.
;
- } else if (Val.equals("fast") || Val.equals("on") || Val.equals("off")) {
+ } else if (Val.equals("fast") || Val.equals("on") || Val.equals("off") ||
+ Val.equals("fast-honor-pragmas")) {
FPContract = Val;
LastSeenFfpContractOption = Val;
} else
diff --git a/clang/test/Driver/fp-contract.c b/clang/test/Driver/fp-contract.c
index e89c57d6fd68f4..660f67fad3ccbe 100644
--- a/clang/test/Driver/fp-contract.c
+++ b/clang/test/Driver/fp-contract.c
@@ -21,6 +21,10 @@
// RUN: %clang -### -ffast-math -ffp-contract=fast -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s
+// RUN: %clang -### -ffast-math -ffp-contract=fast-honor-pragmas -c %s 2>&1 \
+// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST-HONOR %s
+// CHECK-FPC-FAST-HONOR: "-ffp-contract=fast-honor-pragmas"
+
// RUN: %clang -### -ffp-contract=fast -ffast-math -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-FPC-FAST %s
// RUN: %clang -### -ffp-contract=on -ffast-math -c %s 2>&1 \
More information about the cfe-commits
mailing list