[PATCH] D97816: [clang] Note that -debug-pass only works with legacy PM when using new PM

Arthur Eubanks via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 2 16:25:20 PST 2021


aeubanks created this revision.
aeubanks added a reviewer: ychen.
aeubanks requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Follow-up to https://reviews.llvm.org/D97810.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D97816

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/test/Misc/debug-pass-npm.c


Index: clang/test/Misc/debug-pass-npm.c
===================================================================
--- /dev/null
+++ clang/test/Misc/debug-pass-npm.c
@@ -0,0 +1,8 @@
+// RUN: %clang -fexperimental-new-pass-manager %s -c -o /dev/null -mllvm -debug-pass=Structure 2>&1 | FileCheck %s
+// RUN: %clang -fexperimental-new-pass-manager %s -c -o /dev/null -fdebug-pass-arguments 2>&1 | FileCheck %s
+// RUN: %clang -flegacy-pass-manager %s -c -o /dev/null -fdebug-pass-arguments 2>&1 | FileCheck %s --check-prefix=LPM
+
+void foo() {}
+
+// CHECK: does not work
+// LPM-NOT: does not work
Index: clang/lib/CodeGen/BackendUtil.cpp
===================================================================
--- clang/lib/CodeGen/BackendUtil.cpp
+++ clang/lib/CodeGen/BackendUtil.cpp
@@ -1179,6 +1179,14 @@
   TimeRegion Region(CodeGenOpts.TimePasses ? &CodeGenerationTime : nullptr);
   setCommandLineOpts(CodeGenOpts);
 
+  if (llvm::legacy::debugPassSpecified()) {
+    llvm::errs()
+        << "-debug-pass/-fdebug-pass-* does not work with the new pass manager "
+           "for the middle-end optimization pipeline, either use "
+           "-fdebug-pass-manager, or use the legacy PM "
+           "(-flegacy-pass-manager)\n";
+  }
+
   bool RequiresCodeGen = (Action != Backend_EmitNothing &&
                           Action != Backend_EmitBC &&
                           Action != Backend_EmitLL);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97816.327623.patch
Type: text/x-patch
Size: 1403 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210303/30a28410/attachment.bin>


More information about the cfe-commits mailing list