[PATCH] D121969: Pass split-machine-functions to code generator when flto is used

Junfeng Dong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 17 17:25:43 PDT 2022


junfd updated this revision to Diff 416363.
junfd added a comment.

Follow clang format.


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/split-machine-functions.c


Index: clang/test/Driver/split-machine-functions.c
===================================================================
--- /dev/null
+++ clang/test/Driver/split-machine-functions.c
@@ -0,0 +1,8 @@
+// Test options pass-through with lto
+// RUN: %clang -### -flto -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-PASS
+
+// Test no pass-through to ld without lto
+// RUN: %clang -### -fsplit-machine-functions %s 2>&1 | FileCheck %s -check-prefix=CHECK-NOPASS
+
+// 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,10 @@
     CmdArgs.push_back("-plugin-opt=-data-sections");
   }
 
+  if (Args.hasArg(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.416363.patch
Type: text/x-patch
Size: 1165 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220318/4c987331/attachment.bin>


More information about the cfe-commits mailing list