[clang] 64aaf05 - [Clang] [Driver] Ensure `-fms-volatile` is set for x86 for `*-windows-msvc` triple on non cl driver modes (#107509)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 16 20:17:34 PDT 2024
Author: Max Winkler
Date: 2024-09-16T20:17:31-07:00
New Revision: 64aaf0559d9333dc00c04bb581739ddc5da358b2
URL: https://github.com/llvm/llvm-project/commit/64aaf0559d9333dc00c04bb581739ddc5da358b2
DIFF: https://github.com/llvm/llvm-project/commit/64aaf0559d9333dc00c04bb581739ddc5da358b2.diff
LOG: [Clang] [Driver] Ensure `-fms-volatile` is set for x86 for `*-windows-msvc` triple on non cl driver modes (#107509)
Similar reasoning as this PR:
https://github.com/llvm/llvm-project/pull/107177
`-fms-volatile` should be set by default for x86 targets as long as the
triple is `*-windows-msvc`.
The driver mode shouldn't dictate the triple when targeting msvc
compatibility.
Added:
Modified:
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/clang_f_opts.c
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 3fe4ce5d893b8d..494883500342e4 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -6004,7 +6004,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
}
if (Args.hasFlag(options::OPT_fms_volatile, options::OPT_fno_ms_volatile,
- Triple.isX86() && D.IsCLMode()))
+ Triple.isX86() && IsWindowsMSVC))
CmdArgs.push_back("-fms-volatile");
// Non-PIC code defaults to -fdirect-access-external-data while PIC code
diff --git a/clang/test/Driver/clang_f_opts.c b/clang/test/Driver/clang_f_opts.c
index 335fa546a13887..adb6f075b6c15d 100644
--- a/clang/test/Driver/clang_f_opts.c
+++ b/clang/test/Driver/clang_f_opts.c
@@ -623,6 +623,10 @@
// RUN: %clang -### --target=aarch64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
// RUN: %clang -### --target=aarch64-windows-msvc -fms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
// RUN: %clang -### --target=aarch64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
+// RUN: %clang -### --target=x86_64-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
+// RUN: %clang -### --target=x86_64-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
+// RUN: %clang -### --target=i686-windows-msvc %s 2>&1 | FileCheck -check-prefix=CHECK-MS-VOLATILE %s
+// RUN: %clang -### --target=i686-windows-msvc -fno-ms-volatile %s 2>&1 | FileCheck -check-prefix=CHECK-NO-MS-VOLATILE %s
// CHECK-MS-VOLATILE: -fms-volatile
// CHECK-NO-MS-VOLATILE-NOT: -fms-volatile
More information about the cfe-commits
mailing list