[opt] Rename -enable-new-pm -> -bugpoint-enable-legacy-pm

-enable-new-pm is no longer necessary except for bugpoint. Make the name more clunky so it hopefully won't be used.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D146103
This commit is contained in:
Arthur Eubanks 2023-03-14 16:23:53 -07:00
parent 4c8ee1ac82
commit c1b4240322
8 changed files with 13 additions and 46 deletions

View File

@ -420,17 +420,6 @@ for more details.
Invoking ``opt``
================
To use the legacy pass manager:
.. code-block:: shell
$ opt -enable-new-pm=0 -pass1 -pass2 /tmp/a.ll -S
This will be removed once the legacy pass manager is deprecated and removed for
the optimization pipeline.
To use the new PM:
.. code-block:: shell
$ opt -passes='pass1,pass2' /tmp/a.ll -S

View File

@ -36,11 +36,10 @@ advanced features are discussed.
.. warning::
This document deals with the legacy pass manager. LLVM uses the new pass
manager by default for the optimization pipeline (the codegen pipeline is
still using the legacy pass manager), which has its own way of defining
manager for the optimization pipeline (the codegen pipeline
still uses the legacy pass manager), which has its own way of defining
passes. For more details, see :doc:`WritingAnLLVMNewPMPass` and
:doc:`NewPassManager`. To use the legacy pass manager with ``opt``, pass
the ``-enable-new-pm=0`` flag to all ``opt`` invocations.
:doc:`NewPassManager`.
Quick Start --- Writing hello world
===================================

View File

@ -3,7 +3,7 @@
; RUN: echo "print('args = ' + str(sys.argv))" >> %t.py
; RUN: echo "exit(1)" >> %t.py
; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%pluginext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%python -opt-args %t.py | FileCheck %s
; RUN: not --crash opt -enable-new-pm=0 -load %llvmshlibdir/BugpointPasses%pluginext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
; RUN: not --crash opt -bugpoint-enable-legacy-pm -load %llvmshlibdir/BugpointPasses%pluginext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%pluginext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%t.non.existent.opt.binary -opt-args %t.py 2>&1 | FileCheck %s --check-prefix=BAD-OPT
; Test that bugpoint disables symbolication on the opt tool to reduce runtime overhead when opt crashes

View File

@ -7,10 +7,6 @@
; REQUIRES: plugins, examples
; UNSUPPORTED: target={{.*windows.*}}
; CHECK: Bye
;
; Specifying a new PM pass plugin with the old PM is an error.
; RUN: ! opt %s %loadnewpmbye -goodbye -wave-goodbye -disable-output -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=ERROR
; ERROR: load-pass-plugin specified with legacy PM.
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

View File

@ -19,16 +19,3 @@ define void @f() {
unreachable
}
; Legacy PM deprecation tests (tests should be removed in the future).
;
; RUN: not opt -enable-new-pm=0 -O0 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; RUN: not opt -enable-new-pm=0 -O1 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; RUN: not opt -enable-new-pm=0 -O2 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; RUN: not opt -enable-new-pm=0 -O3 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; RUN: not opt -enable-new-pm=0 -Os < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; RUN: not opt -enable-new-pm=0 -Oz < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; RUN: not opt -O1 -codegenprepare < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; RUN: not opt -codegenprepare -O2 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
; LEGACYPM-ERROR: Cannot use -O# with legacy PM

View File

@ -4,7 +4,6 @@
; RUN: opt /dev/null -disable-output -passes=instcombine 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
; RUN: not opt /dev/null -disable-output -instcombine 2>&1 | FileCheck %s --check-prefix=WARN
; RUN: not opt /dev/null -disable-output -instcombine -always-inline 2>&1 | FileCheck %s --check-prefix=WARN
; RUN: opt /dev/null -disable-output -instcombine -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
; RUN: opt /dev/null -disable-output -codegenprepare -mtriple=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
; OK-NOT: deprecated

View File

@ -207,7 +207,7 @@ bool BugDriver::runPasses(Module &Program,
Args.push_back(OptArgs[i]);
// Pin to legacy PM since bugpoint has lots of infra and hacks revolving
// around the legacy PM.
Args.push_back("-enable-new-pm=0");
Args.push_back("-bugpoint-enable-legacy-pm");
Args.push_back("-disable-symbolication");
Args.push_back("-o");
Args.push_back(OutputFilename);

View File

@ -68,12 +68,12 @@ static codegen::RegisterCodeGenFlags CFG;
static cl::list<const PassInfo *, bool, PassNameParser> PassList(cl::desc(
"Optimizations available (use '-passes=' for the new pass manager)"));
static cl::opt<bool> EnableNewPassManager(
"enable-new-pm",
cl::desc("Enable the new pass manager, translating "
"'opt -foo' to 'opt -passes=foo'. This is strictly for the new PM "
"migration, use '-passes=' when possible."),
cl::init(true));
static cl::opt<bool> EnableLegacyPassManager(
"bugpoint-enable-legacy-pm",
cl::desc(
"Enable the legacy pass manager. This is strictly for bugpoint "
"due to it not working with the new PM, please do not use otherwise."),
cl::init(false));
// This flag specifies a textual description of the optimization pass pipeline
// to run over the module. This flag switches opt to use the new pass manager
@ -485,11 +485,8 @@ int main(int argc, char **argv) {
LLVMContext Context;
// If `-passes=` is specified, use NPM.
// If `-enable-new-pm` is specified and there are no codegen passes, use NPM.
// e.g. `-enable-new-pm -sroa` will use NPM.
// but `-enable-new-pm -codegenprepare` will still revert to legacy PM.
const bool UseNPM = (EnableNewPassManager && !shouldForceLegacyPM()) ||
// TODO: remove shouldForceLegacyPM().
const bool UseNPM = (!EnableLegacyPassManager && !shouldForceLegacyPM()) ||
PassPipeline.getNumOccurrences() > 0;
if (UseNPM && !PassList.empty()) {