[PATCH] D121969: Pass split-machine-functions to code generator when flto is used
Hongtao Yu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 23 08:55:42 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG72acd042bad3: Pass split-machine-functions to code generator when flto is used (authored by junfd, committed by hoy).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121969/new/
https://reviews.llvm.org/D121969
Files:
clang/lib/Driver/ToolChains/CommonArgs.cpp
clang/test/Driver/fsplit-machine-functions2.c
Index: clang/test/Driver/fsplit-machine-functions2.c
===================================================================
--- /dev/null
+++ clang/test/Driver/fsplit-machine-functions2.c
@@ -0,0 +1,12 @@
+// Test -fsplit-machine-functions option pass-through with lto
+// RUN: %clang -### -target x86_64-unknown-linux -flto -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
+
+// Test no pass-through to ld without lto
+// RUN: %clang -### -target x86_64-unknown-linux -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
+
+// Test the mix of -fsplit-machine-functions and -fno-split-machine-functions
+// RUN: %clang -### -target x86_64-unknown-linux -flto -fsplit-machine-functions -fno-split-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
+// RUN: %clang -### -target x86_64-unknown-linux -flto -fno-split-machine-functions -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
+
+// CHECK-PASS: "-plugin-opt=-split-machine-functions"
+// CHECK-NOPASS-NOT: "-plugin-opt=-split-machine-functions"
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -574,6 +574,13 @@
CmdArgs.push_back("-plugin-opt=-data-sections");
}
+ // Pass an option to enable split machine functions.
+ if (auto *A = Args.getLastArg(options::OPT_fsplit_machine_functions,
+ options::OPT_fno_split_machine_functions)) {
+ if (A->getOption().matches(options::OPT_fsplit_machine_functions))
+ CmdArgs.push_back("-plugin-opt=-split-machine-functions");
+ }
+
if (Arg *A = getLastProfileSampleUseArg(Args)) {
StringRef FName = A->getValue();
if (!llvm::sys::fs::exists(FName))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121969.417647.patch
Type: text/x-patch
Size: 1873 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220323/cf8be44a/attachment-0001.bin>
More information about the cfe-commits
mailing list