Skip to content

Commit 38eea2e

Browse files
committed
[clang][FMV] Pass the '+fmv' target-feature when FMV is enabled.
This will allow the backend to enable the corresponding subtarget feature (FeatureFMV), which in turn can be queried for llvm codegen decisions. See llvm#87939 for example.
1 parent a522dbb commit 38eea2e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7815,13 +7815,14 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
78157815

78167816
addOutlineAtomicsArgs(D, getToolChain(), Args, CmdArgs, Triple);
78177817

7818-
if (Triple.isAArch64() &&
7819-
(Args.hasArg(options::OPT_mno_fmv) ||
7820-
(Triple.isAndroid() && Triple.isAndroidVersionLT(23)) ||
7821-
getToolChain().GetRuntimeLibType(Args) != ToolChain::RLT_CompilerRT)) {
7822-
// Disable Function Multiversioning on AArch64 target.
7818+
if (Triple.isAArch64()) {
78237819
CmdArgs.push_back("-target-feature");
7824-
CmdArgs.push_back("-fmv");
7820+
if (Args.hasArg(options::OPT_mno_fmv) ||
7821+
(Triple.isAndroid() && Triple.isAndroidVersionLT(23)) ||
7822+
getToolChain().GetRuntimeLibType(Args) != ToolChain::RLT_CompilerRT)
7823+
CmdArgs.push_back("-fmv");
7824+
else
7825+
CmdArgs.push_back("+fmv");
78257826
}
78267827

78277828
if (Args.hasFlag(options::OPT_faddrsig, options::OPT_fno_addrsig,

clang/test/Driver/aarch64-features.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
// CHECK-FMV-OFF: "-target-feature" "-fmv"
2626
// CHECK-FMV-NOT: "-target-feature" "-fmv"
27+
// CHECK-FMV: "-target-feature" "+fmv"
2728

2829
// Check for AArch64 out-of-line atomics default settings.
2930
// RUN: %clang --target=aarch64-linux-android -rtlib=compiler-rt \

0 commit comments

Comments
 (0)