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

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


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG73472b6ee76a: [opt] NewPM: `opt -passname` syntax is dead, long live `opt -passes=<pipeline>`! (authored by lebedev.ri).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139677/new/

https://reviews.llvm.org/D139677

Files:
  llvm/test/Other/opt-legacy-syntax-deprecation.ll
  llvm/test/Other/opt-old-new-pm-passes.ll
  llvm/tools/opt/opt.cpp


Index: llvm/tools/opt/opt.cpp
===================================================================
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -87,12 +87,6 @@
 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 @@
   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 @@
                 "-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;
Index: llvm/test/Other/opt-old-new-pm-passes.ll
===================================================================
--- 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
Index: llvm/test/Other/opt-legacy-syntax-deprecation.ll
===================================================================
--- llvm/test/Other/opt-legacy-syntax-deprecation.ll
+++ 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).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D139677.482116.patch
Type: text/x-patch
Size: 4586 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221212/81ebcf18/attachment.bin>


More information about the llvm-commits mailing list