[PATCH] D48682: [MachineOutliner] Add always and never options to -enable-machine-outliner
Jessica Paquette via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 11:04:40 PDT 2018
paquette updated this revision to Diff 153358.
paquette added a comment.
Removed the reference to enable-linkonceodr-outlining, since it was confusing.
https://reviews.llvm.org/D48682
Files:
lib/CodeGen/TargetPassConfig.cpp
test/CodeGen/AArch64/machine-outliner-flags.ll
Index: test/CodeGen/AArch64/machine-outliner-flags.ll
===================================================================
--- /dev/null
+++ test/CodeGen/AArch64/machine-outliner-flags.ll
@@ -0,0 +1,30 @@
+; RUN: llc %s -debug-pass=Structure -verify-machineinstrs \
+; RUN: -enable-machine-outliner=always -mtriple arm64---- -o /dev/null 2>&1 \
+; RUN: | FileCheck %s -check-prefix=ALWAYS
+
+; RUN: llc %s -debug-pass=Structure -verify-machineinstrs \
+; RUN: -enable-machine-outliner -mtriple arm64---- -o /dev/null 2>&1 \
+; RUN: | FileCheck %s -check-prefix=ENABLE
+
+; RUN: llc %s -debug-pass=Structure -verify-machineinstrs \
+; RUN: -enable-machine-outliner=never -mtriple arm64---- -o /dev/null 2>&1 \
+; RUN: | FileCheck %s -check-prefix=NEVER
+
+; RUN: llc %s -debug-pass=Structure -verify-machineinstrs \
+; RUN: -mtriple arm64---- -o /dev/null 2>&1 \
+; RUN: | FileCheck %s -check-prefix=NOT-ADDED
+
+; Make sure that the outliner flags all work properly. If we specify
+; -enable-machine-outliner with always or no argument, it should be added to the
+; pass pipeline. If we specify it with never, or don't pass the flag,
+; then we shouldn't add it.
+
+; ALWAYS: Machine Outliner
+; ENABLE: Machine Outliner
+; NEVER-NOT: Machine Outliner
+; NOT-ADDED-NOT: Machine Outliner
+
+define void @foo() {
+ ret void;
+}
+
Index: lib/CodeGen/TargetPassConfig.cpp
===================================================================
--- lib/CodeGen/TargetPassConfig.cpp
+++ lib/CodeGen/TargetPassConfig.cpp
@@ -111,9 +111,16 @@
cl::desc("Verify generated machine code"),
cl::init(false),
cl::ZeroOrMore);
-static cl::opt<bool> EnableMachineOutliner("enable-machine-outliner",
- cl::Hidden,
- cl::desc("Enable machine outliner"));
+enum RunOutliner { AlwaysOutline, NeverOutline };
+// Enable or disable the MachineOutliner.
+static cl::opt<RunOutliner> EnableMachineOutliner(
+ "enable-machine-outliner", cl::desc("Enable the machine outliner"),
+ cl::Hidden, cl::ValueOptional, cl::init(NeverOutline),
+ cl::values(clEnumValN(AlwaysOutline, "always",
+ "Run on all functions guaranteed to be beneficial"),
+ clEnumValN(NeverOutline, "never", "Disable all outlining"),
+ // Sentinel value for unspecified option.
+ clEnumValN(AlwaysOutline, "", "")));
// Enable or disable FastISel. Both options are needed, because
// FastISel is enabled by default with -fast, and we wish to be
// able to enable or disable fast-isel independently from -O0.
@@ -907,7 +914,7 @@
addPass(&PatchableFunctionID, false);
if (TM->Options.EnableMachineOutliner &&
- EnableMachineOutliner)
+ EnableMachineOutliner == AlwaysOutline)
addPass(createMachineOutlinerPass());
// Add passes that directly emit MI after all other MI passes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48682.153358.patch
Type: text/x-patch
Size: 2841 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180628/75058780/attachment.bin>
More information about the llvm-commits
mailing list