[llvm] r335879 - [MachineOutliner] Never add the outliner in -O0

Jessica Paquette via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 28 10:05:57 PDT 2018


Author: paquette
Date: Thu Jun 28 10:05:57 2018
New Revision: 335879

URL: http://llvm.org/viewvc/llvm-project?rev=335879&view=rev
Log:
[MachineOutliner] Never add the outliner in -O0

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 updates machine-outliner-flags to reflect the change
and improves the comment describing what that test does.

Modified:
    llvm/trunk/lib/CodeGen/TargetPassConfig.cpp
    llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll

Modified: llvm/trunk/lib/CodeGen/TargetPassConfig.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/TargetPassConfig.cpp?rev=335879&r1=335878&r2=335879&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/TargetPassConfig.cpp (original)
+++ llvm/trunk/lib/CodeGen/TargetPassConfig.cpp Thu Jun 28 10:05:57 2018
@@ -914,7 +914,8 @@ void TargetPassConfig::addMachinePasses(
   addPass(&XRayInstrumentationID, false);
   addPass(&PatchableFunctionID, false);
 
-  if (EnableMachineOutliner == AlwaysOutline)
+  if (getOptLevel() != CodeGenOpt::None &&
+      EnableMachineOutliner == AlwaysOutline)
     addPass(createMachineOutlinerPass());
 
   // Add passes that directly emit MI after all other MI passes.

Modified: 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=335879&r1=335878&r2=335879&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/machine-outliner-flags.ll Thu Jun 28 10:05:57 2018
@@ -14,15 +14,27 @@
 ; 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.
+; 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
+;  * -enable-machine-outliner=always
+;
+; Cases where it should not be added:
+;  * -enable-machine-outliner=never
+;  * -O0 or equivalent
+;  * -enable-machine-outliner is not passed
 
 ; ALWAYS: Machine Outliner
 ; ENABLE: Machine Outliner
 ; NEVER-NOT: Machine Outliner
 ; NOT-ADDED-NOT: Machine Outliner
+; OPTNONE-NOT: Machine Outliner
 
 define void @foo() {
   ret void;




More information about the llvm-commits mailing list