[PATCH] D122992: Remove wrong warning. Fix for https://github.com/llvm/llvm-project/issues/54625
Zahira Ammarguellat via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 3 04:59:59 PDT 2022
zahiraam created this revision.
zahiraam added reviewers: andrew.w.kaylor, aaron.ballman, efriedma.
Herald added a project: All.
zahiraam requested review of this revision.
Herald added a subscriber: MaskRay.
Herald added a project: clang.
When driver's floating-point options change, the user is made aware via a diagnostic. In the case of combining a fast math option with a non-fast option there should be no diagnostic. This patch removes the wrong diagnostic.
This is a fix for https://github.com/llvm/llvm-project/issues/54625.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122992
Files:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/fp-model.c
Index: clang/test/Driver/fp-model.c
===================================================================
--- clang/test/Driver/fp-model.c
+++ clang/test/Driver/fp-model.c
@@ -3,6 +3,8 @@
//
// REQUIRES: clang-driver
+// expected-no-diagnostics
+
// RUN: %clang -### -ffp-model=fast -ffp-contract=off -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=WARN %s
// WARN: warning: overriding '-ffp-model=fast' option with '-ffp-contract=off' [-Woverriding-t-option]
@@ -19,6 +21,13 @@
// RUN: | FileCheck --check-prefix=WARN3 %s
// WARN3: warning: overriding '-ffp-model=strict' option with '-ffast-math' [-Woverriding-t-option]
+// RUN: %clang -c -ffast-math -fno-fast-math -Xclang -verify %s 2>&1
+// RUN: %clang -c -fno-fast-math -ffast-math -Xclang -verify %s 2>&1
+// RUN: %clang -c -ffast-math -ffp-contract=on -Xclang -verify %s 2>&1
+// RUN: %clang -c -ffp-contract=on -ffast-math -Xclang -verify %s 2>&1
+// RUN: %clang -c -ffp-contract=on -ffp-model=fast -Xclang -verify %s 2>&1
+// RUN: %clang -c -ffp-model=fast -ffp-contract=on -Xclang -verify %s 2>&1
+
// RUN: %clang -### -ffp-model=strict -ffinite-math-only -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=WARN4 %s
// WARN4: warning: overriding '-ffp-model=strict' option with '-ffinite-math-only' [-Woverriding-t-option]
@@ -63,6 +72,9 @@
// RUN: | FileCheck --check-prefix=WARNf %s
// WARNf: warning: overriding '-ffp-model=strict' option with '-Ofast' [-Woverriding-t-option]
+// RUN: %clang -c -Ofast -fno-fast-math -Xclang -verify %s 2>&1
+// RUN: %clang -c -fno-fast-math -Ofast -Xclang -verify %s 2>&1
+
// RUN: %clang -### -ffp-model=strict -fdenormal-fp-math=preserve-sign,preserve-sign -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=WARN10 %s
// WARN10: warning: overriding '-ffp-model=strict' option with '-fdenormal-fp-math=preserve-sign,preserve-sign' [-Woverriding-t-option]
@@ -102,6 +114,9 @@
// CHECK-FPM-PRECISE: "-ffp-contract=on"
// CHECK-FPM-PRECISE: "-fno-rounding-math"
+// RUN: %clang -c -ffp-model=precise -ffp-contract=fast -Xclang -verify %s 2>&1
+// RUN: %clang -c -ffp-contract=fast -ffp-model=precise -Xclang -verify %s 2>&1
+
// RUN: %clang -### -nostdinc -ffp-model=strict -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=CHECK-FPM-STRICT %s
// CHECK-FPM-STRICT: "-cc1"
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -3006,9 +3006,6 @@
!JA.isOffloading(Action::OFK_HIP))
if (FPContract == "fast") {
FPContract = "on";
- D.Diag(clang::diag::warn_drv_overriding_flag_option)
- << "-ffp-contract=fast"
- << "-ffp-contract=on";
}
break;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122992.420038.patch
Type: text/x-patch
Size: 2806 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220403/72f6c2ea/attachment.bin>
More information about the cfe-commits
mailing list