diff options
-rw-r--r-- | llvm/lib/CodeGen/TargetPassConfig.cpp | 2 | ||||
-rw-r--r-- | llvm/test/CodeGen/AArch64/machine-outliner-flags.ll | 30 | ||||
-rw-r--r-- | llvm/test/DebugInfo/AArch64/machine-outliner.ll | 2 |
3 files changed, 32 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/TargetPassConfig.cpp b/llvm/lib/CodeGen/TargetPassConfig.cpp index 0ac89917012..044dcf7c749 100644 --- a/llvm/lib/CodeGen/TargetPassConfig.cpp +++ b/llvm/lib/CodeGen/TargetPassConfig.cpp @@ -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()); diff --git a/llvm/test/CodeGen/AArch64/machine-outliner-flags.ll b/llvm/test/CodeGen/AArch64/machine-outliner-flags.ll new file mode 100644 index 00000000000..33180ddb384 --- /dev/null +++ b/llvm/test/CodeGen/AArch64/machine-outliner-flags.ll @@ -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; +} + diff --git a/llvm/test/DebugInfo/AArch64/machine-outliner.ll b/llvm/test/DebugInfo/AArch64/machine-outliner.ll index 9670b96e7ee..d3b5beaf996 100644 --- a/llvm/test/DebugInfo/AArch64/machine-outliner.ll +++ b/llvm/test/DebugInfo/AArch64/machine-outliner.ll @@ -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 |