[PATCH] D157925: [MachineOutliner][LTO] Enable outlining of linkonceodr functions on all targets.

Jon Roelofs via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 14 16:23:10 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a135bceb66b: [MachineOutliner][LTO] Enable outlining of linkonceodr functions on all targets. (authored by jroelofs).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D157925/new/

https://reviews.llvm.org/D157925

Files:
  clang/lib/Driver/ToolChains/Darwin.cpp
  clang/test/Driver/darwin-ld.c


Index: clang/test/Driver/darwin-ld.c
===================================================================
--- clang/test/Driver/darwin-ld.c
+++ clang/test/Driver/darwin-ld.c
@@ -358,11 +358,31 @@
 // Check that we can pass the outliner down to the linker.
 // RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \
 // RUN:   %clang -target arm64-apple-darwin -moutline -### %t.o 2> %t.log
-// RUN: FileCheck -check-prefix=MOUTLINE %s < %t.log
-// MOUTLINE: {{ld(.exe)?"}}
-// MOUTLINE-SAME: "-mllvm" "-enable-machine-outliner" "-mllvm" "-enable-linkonceodr-outlining"
+// RUN: FileCheck -check-prefix=ARM64-MOUTLINE %s < %t.log
+// ARM64-MOUTLINE: {{ld(.exe)?"}}
+// ARM64-MOUTLINE-SAME: "-mllvm" "-enable-machine-outliner" "-mllvm" "-enable-linkonceodr-outlining"
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \
+// RUN:   %clang -target arm64e-apple-darwin -moutline -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=ARM64E-MOUTLINE %s < %t.log
+// ARM64E-MOUTLINE: {{ld(.exe)?"}}
+// ARM64E-MOUTLINE-SAME: "-mllvm" "-enable-linkonceodr-outlining"
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \
+// RUN:   %clang -target armv7em-apple-darwin -moutline -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=ARMV7EM-MOUTLINE %s < %t.log
+// ARMV7EM-MOUTLINE: {{ld(.exe)?"}}
+// ARMV7EM-MOUTLINE-SAME: "-mllvm" "-enable-linkonceodr-outlining"
 // RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \
 // RUN:   %clang -target arm64-apple-darwin -mno-outline -### %t.o 2> %t.log
-// RUN: FileCheck -check-prefix=MNO_OUTLINE %s < %t.log
-// MNO_OUTLINE: {{ld(.exe)?"}}
-// MNO_OUTLINE-SAME: "-mllvm" "-enable-machine-outliner=never"
+// RUN: FileCheck -check-prefix=ARM64-MNO_OUTLINE %s < %t.log
+// ARM64-MNO_OUTLINE: {{ld(.exe)?"}}
+// ARM64-MNO_OUTLINE-SAME: "-mllvm" "-enable-machine-outliner=never" "-mllvm" "-enable-linkonceodr-outlining"
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \
+// RUN:   %clang -target arm64e-apple-darwin -mno-outline -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=ARM64E-MNO_OUTLINE %s < %t.log
+// ARM64E-MNO_OUTLINE: {{ld(.exe)?"}}
+// ARM64E-MNO_OUTLINE-SAME: "-mllvm" "-enable-machine-outliner=never" "-mllvm" "-enable-linkonceodr-outlining"
+// RUN: env IPHONEOS_DEPLOYMENT_TARGET=7.0 \
+// RUN:   %clang -target armv7em-apple-darwin -mno-outline -### %t.o 2> %t.log
+// RUN: FileCheck -check-prefix=ARMV7EM-MNO_OUTLINE %s < %t.log
+// ARMV7EM-MNO_OUTLINE: {{ld(.exe)?"}}
+// ARMV7EM-MNO_OUTLINE-SAME: "-mllvm" "-enable-machine-outliner=never" "-mllvm" "-enable-linkonceodr-outlining"
\ No newline at end of file
Index: clang/lib/Driver/ToolChains/Darwin.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Darwin.cpp
+++ clang/lib/Driver/ToolChains/Darwin.cpp
@@ -615,10 +615,6 @@
       if (getMachOToolChain().getMachOArchName(Args) == "arm64") {
         CmdArgs.push_back("-mllvm");
         CmdArgs.push_back("-enable-machine-outliner");
-
-        // Outline from linkonceodr functions by default in LTO.
-        CmdArgs.push_back("-mllvm");
-        CmdArgs.push_back("-enable-linkonceodr-outlining");
       }
     } else {
       // Disable all outlining behaviour if we have mno-outline. We need to do
@@ -629,6 +625,12 @@
     }
   }
 
+  // Outline from linkonceodr functions by default in LTO, whenever the outliner
+  // is enabled.  Note that the target may enable the machine outliner
+  // independently of -moutline.
+  CmdArgs.push_back("-mllvm");
+  CmdArgs.push_back("-enable-linkonceodr-outlining");
+
   // Setup statistics file output.
   SmallString<128> StatsFile =
       getStatsFileName(Args, Output, Inputs[0], getToolChain().getDriver());


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D157925.550123.patch
Type: text/x-patch
Size: 3640 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230814/d588923c/attachment.bin>


More information about the cfe-commits mailing list