[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 Oct 24 09:44:45 PDT 2022
aeubanks created this revision.
Herald added a reviewer: ctetreau.
Herald added a project: All.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
And a possible opt invocation plus a link to more extensive documentation.
Repository:
rG LLVM Github Monorepo
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,17 @@
"-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=";
+ errs() << PassList[0]->getPassArgument();
+ for (auto &P : drop_begin(PassList)) {
+ errs() << "," << P->getPassArgument();
+ }
+ errs() << "` (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 @@
+; 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=WARN1
+; RUN: opt /dev/null -disable-output -instcombine -globaldce 2>&1 | FileCheck %s --check-prefix=WARN2
+; RUN: opt /dev/null -disable-output -instcombine -enable-new-pm=0 2>&1 | FileCheck %s --check-prefix=OK --allow-empty
+
+; OK-NOT: deprecated
+
+; WARN1: The `opt -passname` syntax for the new pass manager is deprecated, please use `opt -passes=instcombine` (or the `-p` alias for a more concise version.
+;; This opt invocation actually doesn't work due to module/function nesting, people should see the link
+; WARN2: The `opt -passname` syntax for the new pass manager is deprecated, please use `opt -passes=instcombine,globaldce` (or the `-p` alias for a more concise version.
+; WARN2: for more details
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136617.470192.patch
Type: text/x-patch
Size: 2090 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221024/a2139ac5/attachment-0001.bin>
More information about the llvm-commits
mailing list