[llvm] r335930 - [MachineOutliner] Never add the outliner in -O0
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 28 14:49:24 PDT 2018
Author: paquette
Date: Thu Jun 28 14:49:24 2018
New Revision: 335930
URL: http://llvm.org/viewvc/llvm-project?rev=335930&view=rev
Log:
[MachineOutliner] Never add the outliner in -O0
This is a recommit of r335879.
We shouldn't add the outliner when compiling at -O0 even if
-enable-machine-outliner is passed in. This makes sure that we
don't add it in this case.
This also removes -O0 from the outliner DWARF test.
Added:
llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll
Modified:
llvm/trunk/lib/CodeGen/TargetPassConfig.cpp
llvm/trunk/test/DebugInfo/AArch64/machine-outliner.ll
Modified: llvm/trunk/lib/CodeGen/TargetPassConfig.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetPassConfig.cpp?rev=335930&r1=335929&r2=335930&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetPassConfig.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetPassConfig.cpp Thu Jun 28 14:49:24 2018
@@ -906,7 +906,7 @@ void TargetPassConfig::addMachinePasses(
addPass(&XRayInstrumentationID, false);
addPass(&PatchableFunctionID, false);
- if (TM->Options.EnableMachineOutliner &&
+ if (TM->Options.EnableMachineOutliner && getOptLevel() != CodeGenOpt::None &&
EnableMachineOutliner)
addPass(createMachineOutlinerPass());
Added: llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll?rev=335930&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll (added)
+++ llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll Thu Jun 28 14:49:24 2018
@@ -0,0 +1,30 @@
+; 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: -mtriple arm64---- -o /dev/null 2>&1 \
+; RUN: | FileCheck %s -check-prefix=NOT-ADDED
+
+; RUN: llc %s -O=0 -debug-pass=Structure -verify-machineinstrs \
+; RUN: -mtriple arm64---- -o /dev/null 2>&1 \
+; RUN: | FileCheck %s -check-prefix=OPTNONE
+
+; Make sure that the outliner is added to the pass pipeline only when the
+; appropriate flags/settings are set. Make sure it isn't added otherwise.
+;
+; Cases where it should be added:
+; * -enable-machine-outliner
+;
+; Cases where it should not be added:
+; * -O0 or equivalent
+; * -enable-machine-outliner is not passed
+
+; ENABLE: Machine Outliner
+; NOT-ADDED-NOT: Machine Outliner
+; OPTNONE-NOT: Machine Outliner
+
+define void @foo() {
+ ret void;
+}
+
Modified: llvm/trunk/test/DebugInfo/AArch64/machine-outliner.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/AArch64/machine-outliner.ll?rev=335930&r1=335929&r2=335930&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/AArch64/machine-outliner.ll (original)
+++ llvm/trunk/test/DebugInfo/AArch64/machine-outliner.ll Thu Jun 28 14:49:24 2018
@@ -1,4 +1,4 @@
-; RUN: llc -O0 -verify-machineinstrs -filetype=obj -mtriple=aarch64-- \
+; RUN: llc -verify-machineinstrs -filetype=obj -mtriple=aarch64-- \
; RUN: -enable-machine-outliner < %s | llvm-dwarfdump - | FileCheck %s
; Ensure that the MachineOutliner produces valid DWARF when it creates outlined
More information about the llvm-commits
mailing list