Skip to content

Commit c1b4240

Browse files
committed
[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
1 parent 4c8ee1a commit c1b4240

File tree

8 files changed

+13
-46
lines changed

8 files changed

+13
-46
lines changed

llvm/docs/NewPassManager.rst

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -420,17 +420,6 @@ for more details.
420420
Invoking ``opt``
421421
================
422422

423-
To use the legacy pass manager:
424-
425-
.. code-block:: shell
426-
427-
$ opt -enable-new-pm=0 -pass1 -pass2 /tmp/a.ll -S
428-
429-
This will be removed once the legacy pass manager is deprecated and removed for
430-
the optimization pipeline.
431-
432-
To use the new PM:
433-
434423
.. code-block:: shell
435424
436425
$ opt -passes='pass1,pass2' /tmp/a.ll -S

llvm/docs/WritingAnLLVMPass.rst

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,10 @@ advanced features are discussed.
3636

3737
.. warning::
3838
This document deals with the legacy pass manager. LLVM uses the new pass
39-
manager by default for the optimization pipeline (the codegen pipeline is
40-
still using the legacy pass manager), which has its own way of defining
39+
manager for the optimization pipeline (the codegen pipeline
40+
still uses the legacy pass manager), which has its own way of defining
4141
passes. For more details, see :doc:`WritingAnLLVMNewPMPass` and
42-
:doc:`NewPassManager`. To use the legacy pass manager with ``opt``, pass
43-
the ``-enable-new-pm=0`` flag to all ``opt`` invocations.
42+
:doc:`NewPassManager`.
4443

4544
Quick Start --- Writing hello world
4645
===================================

llvm/test/BugPoint/unsymbolized.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
; RUN: echo "print('args = ' + str(sys.argv))" >> %t.py
44
; RUN: echo "exit(1)" >> %t.py
55
; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%pluginext %s -output-prefix %t -bugpoint-crashcalls -opt-command=%python -opt-args %t.py | FileCheck %s
6-
; RUN: not --crash opt -enable-new-pm=0 -load %llvmshlibdir/BugpointPasses%pluginext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
6+
; RUN: not --crash opt -bugpoint-enable-legacy-pm -load %llvmshlibdir/BugpointPasses%pluginext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s
77
; 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
88

99
; Test that bugpoint disables symbolication on the opt tool to reduce runtime overhead when opt crashes

llvm/test/Feature/load_extension.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
; REQUIRES: plugins, examples
88
; UNSUPPORTED: target={{.*windows.*}}
99
; CHECK: Bye
10-
;
11-
; Specifying a new PM pass plugin with the old PM is an error.
12-
; RUN: ! opt %s %loadnewpmbye -goodbye -wave-goodbye -disable-output -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=ERROR
13-
; ERROR: load-pass-plugin specified with legacy PM.
1410

1511
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
1612
target triple = "x86_64-unknown-linux-gnu"

llvm/test/Other/opt-On.ll

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,3 @@ define void @f() {
1919
unreachable
2020
}
2121

22-
23-
; Legacy PM deprecation tests (tests should be removed in the future).
24-
;
25-
; RUN: not opt -enable-new-pm=0 -O0 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
26-
; RUN: not opt -enable-new-pm=0 -O1 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
27-
; RUN: not opt -enable-new-pm=0 -O2 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
28-
; RUN: not opt -enable-new-pm=0 -O3 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
29-
; RUN: not opt -enable-new-pm=0 -Os < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
30-
; RUN: not opt -enable-new-pm=0 -Oz < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
31-
; RUN: not opt -O1 -codegenprepare < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
32-
; RUN: not opt -codegenprepare -O2 < %s -S 2>&1 | FileCheck %s --check-prefix=LEGACYPM-ERROR
33-
34-
; LEGACYPM-ERROR: Cannot use -O# with legacy PM

llvm/test/Other/opt-legacy-syntax-deprecation.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
; RUN: opt /dev/null -disable-output -passes=instcombine 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
55
; RUN: not opt /dev/null -disable-output -instcombine 2>&1 | FileCheck %s --check-prefix=WARN
66
; RUN: not opt /dev/null -disable-output -instcombine -always-inline 2>&1 | FileCheck %s --check-prefix=WARN
7-
; RUN: opt /dev/null -disable-output -instcombine -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
87
; RUN: opt /dev/null -disable-output -codegenprepare -mtriple=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
98

109
; OK-NOT: deprecated

llvm/tools/bugpoint/OptimizerDriver.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ bool BugDriver::runPasses(Module &Program,
207207
Args.push_back(OptArgs[i]);
208208
// Pin to legacy PM since bugpoint has lots of infra and hacks revolving
209209
// around the legacy PM.
210-
Args.push_back("-enable-new-pm=0");
210+
Args.push_back("-bugpoint-enable-legacy-pm");
211211
Args.push_back("-disable-symbolication");
212212
Args.push_back("-o");
213213
Args.push_back(OutputFilename);

llvm/tools/opt/opt.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ static codegen::RegisterCodeGenFlags CFG;
6868
static cl::list<const PassInfo *, bool, PassNameParser> PassList(cl::desc(
6969
"Optimizations available (use '-passes=' for the new pass manager)"));
7070

71-
static cl::opt<bool> EnableNewPassManager(
72-
"enable-new-pm",
73-
cl::desc("Enable the new pass manager, translating "
74-
"'opt -foo' to 'opt -passes=foo'. This is strictly for the new PM "
75-
"migration, use '-passes=' when possible."),
76-
cl::init(true));
71+
static cl::opt<bool> EnableLegacyPassManager(
72+
"bugpoint-enable-legacy-pm",
73+
cl::desc(
74+
"Enable the legacy pass manager. This is strictly for bugpoint "
75+
"due to it not working with the new PM, please do not use otherwise."),
76+
cl::init(false));
7777

7878
// This flag specifies a textual description of the optimization pass pipeline
7979
// 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) {
485485

486486
LLVMContext Context;
487487

488-
// If `-passes=` is specified, use NPM.
489-
// If `-enable-new-pm` is specified and there are no codegen passes, use NPM.
490-
// e.g. `-enable-new-pm -sroa` will use NPM.
491-
// but `-enable-new-pm -codegenprepare` will still revert to legacy PM.
492-
const bool UseNPM = (EnableNewPassManager && !shouldForceLegacyPM()) ||
488+
// TODO: remove shouldForceLegacyPM().
489+
const bool UseNPM = (!EnableLegacyPassManager && !shouldForceLegacyPM()) ||
493490
PassPipeline.getNumOccurrences() > 0;
494491

495492
if (UseNPM && !PassList.empty()) {

0 commit comments

Comments
 (0)