[llvm] 73472b6 - [opt] NewPM: `opt -passname` syntax is dead, long live `opt -passes=<pipeline>`!

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 07:20:23 PST 2022


Author: Roman Lebedev
Date: 2022-12-12T18:20:03+03:00
New Revision: 73472b6ee76aba9d487eddc5d51a71de3d7cddb8

URL: https://github.com/llvm/llvm-project/commit/73472b6ee76aba9d487eddc5d51a71de3d7cddb8
DIFF: https://github.com/llvm/llvm-project/commit/73472b6ee76aba9d487eddc5d51a71de3d7cddb8.diff

LOG: [opt] NewPM: `opt -passname` syntax is dead, long live `opt -passes=<pipeline>`!

I've done final pass, and there are no more tests to update.
All other tests (=codegen tests) are using old pass manager.

Reviewed By: nikic

Differential Revision: https://reviews.llvm.org/D139677

Added: 
    

Modified: 
    llvm/test/Other/opt-legacy-syntax-deprecation.ll
    llvm/tools/opt/opt.cpp

Removed: 
    llvm/test/Other/opt-old-new-pm-passes.ll


################################################################################
diff  --git a/llvm/test/Other/opt-legacy-syntax-deprecation.ll b/llvm/test/Other/opt-legacy-syntax-deprecation.ll
index c9d60bd739f70..b7247a7ceef42 100644
--- a/llvm/test/Other/opt-legacy-syntax-deprecation.ll
+++ b/llvm/test/Other/opt-legacy-syntax-deprecation.ll
@@ -1,12 +1,12 @@
 ; REQUIRES: x86-registered-target
 
-; RUN: opt -temporarily-allow-old-pass-syntax /dev/null -disable-output 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
-; RUN: opt -temporarily-allow-old-pass-syntax /dev/null -disable-output -passes=instcombine 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
-; RUN: opt -temporarily-allow-old-pass-syntax /dev/null -disable-output -instcombine 2>&1 | FileCheck %s --check-prefix=WARN
-; RUN: opt -temporarily-allow-old-pass-syntax /dev/null -disable-output -instcombine -globaldce 2>&1 | FileCheck %s --check-prefix=WARN
-; RUN: opt -temporarily-allow-old-pass-syntax /dev/null -disable-output -instcombine -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
-; RUN: opt -temporarily-allow-old-pass-syntax /dev/null -disable-output -codegenprepare -mtriple=x86_64-unknown-linux-gnu 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
+; RUN: opt /dev/null -disable-output 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
+; 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 -globaldce 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
 
-; WARN: The `opt -passname` syntax for the new pass manager is deprecated, please use `opt -passes=<pipeline>` (or the `-p` alias for a more concise version).
+; WARN: The `opt -passname` syntax for the new pass manager is not supported, please use `opt -passes=<pipeline>` (or the `-p` alias for a more concise version).

diff  --git a/llvm/test/Other/opt-old-new-pm-passes.ll b/llvm/test/Other/opt-old-new-pm-passes.ll
deleted file mode 100644
index 09bc7c4016048..0000000000000
--- a/llvm/test/Other/opt-old-new-pm-passes.ll
+++ /dev/null
@@ -1,2 +0,0 @@
-; RUN: not opt -dce --passes=inline %s 2>&1 | FileCheck %s
-; CHECK: Cannot specify passes via both -foo-pass and --passes=foo-pass

diff  --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
index 9a7b63f87822e..12545b3b5c3dc 100644
--- a/llvm/tools/opt/opt.cpp
+++ b/llvm/tools/opt/opt.cpp
@@ -87,12 +87,6 @@ static cl::opt<std::string> PassPipeline(
 static cl::alias PassPipeline2("p", cl::aliasopt(PassPipeline),
                                    cl::desc("Alias for -passes"));
 
-static cl::opt<bool> TemporarilyAllowOldPassesSyntax(
-    "temporarily-allow-old-pass-syntax",
-    cl::desc("Do not use in new tests. To be removed once all tests have "
-             "migrated."),
-    cl::init(false));
-
 static cl::opt<bool> PrintPasses("print-passes",
                                  cl::desc("Print available passes that can be "
                                           "specified in -passes=foo and exit"));
@@ -487,6 +481,15 @@ int main(int argc, char **argv) {
   const bool UseNPM = (EnableNewPassManager && !shouldForceLegacyPM()) ||
                       PassPipeline.getNumOccurrences() > 0;
 
+  if (UseNPM && !PassList.empty()) {
+    errs() << "The `opt -passname` syntax for the new pass manager is "
+              "not supported, please use `opt -passes=<pipeline>` (or the `-p` "
+              "alias for a more concise version).\n";
+    errs() << "See https://llvm.org/docs/NewPassManager.html#invoking-opt "
+              "for more details on the pass pipeline syntax.\n\n";
+    return 1;
+  }
+
   if (!UseNPM && PluginList.size()) {
     errs() << argv[0] << ": " << PassPlugins.ArgStr
            << " specified with legacy PM.\n";
@@ -678,15 +681,6 @@ int main(int argc, char **argv) {
                 "-passes='default<O#>,other-pass'\n";
       return 1;
     }
-    if (!PassList.empty()) {
-      errs() << "The `opt -passname` syntax for the new pass manager is "
-                "deprecated, please use `opt -passes=<pipeline>` (or the `-p` "
-                "alias for a more concise version).\n";
-      errs() << "See https://llvm.org/docs/NewPassManager.html#invoking-opt "
-                "for more details on the pass pipeline syntax.\n\n";
-      if (!TemporarilyAllowOldPassesSyntax)
-        return 1;
-    }
     std::string Pipeline = PassPipeline;
 
     SmallVector<StringRef, 4> Passes;


        


More information about the llvm-commits mailing list