diff --git a/llvm/test/Other/opt-legacy-syntax-deprecation.ll b/llvm/test/Other/opt-legacy-syntax-deprecation.ll
new file mode 100644
--- /dev/null
+++ b/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
diff --git a/llvm/tools/opt/opt.cpp b/llvm/tools/opt/opt.cpp
--- a/llvm/tools/opt/opt.cpp
+++ b/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;