[PATCH] D136617: [opt] Print deprecation warning for use of legacy syntax with new pass manager

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 7 19:47:13 PST 2022


aeubanks updated this revision to Diff 473861.
aeubanks added a comment.

whoops, never uploaded patch


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136617

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


Index: llvm/tools/opt/opt.cpp
===================================================================
--- llvm/tools/opt/opt.cpp
+++ llvm/tools/opt/opt.cpp
@@ -749,6 +749,13 @@
                 "-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";
+    }
     std::string Pipeline = PassPipeline;
 
     SmallVector<StringRef, 4> Passes;
Index: llvm/test/Other/opt-legacy-syntax-deprecation.ll
===================================================================
--- /dev/null
+++ llvm/test/Other/opt-legacy-syntax-deprecation.ll
@@ -0,0 +1,12 @@
+; REQUIRES: x86-registered-target
+
+; 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: opt /dev/null -disable-output -instcombine 2>&1 | FileCheck %s --check-prefix=WARN
+; RUN: 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).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136617.473861.patch
Type: text/x-patch
Size: 1818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221108/a3e12008/attachment.bin>


More information about the llvm-commits mailing list