[PATCH] D100237: [NewPM] Fix -print-changed when a -filter-print-funcs function is removed

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 12 12:01:07 PDT 2021


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbe00edfee55e: [NewPM] Fix -print-changed when a -filter-print-funcs function is removed (authored by aeubanks).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D100237

Files:
  llvm/lib/Passes/StandardInstrumentations.cpp
  llvm/test/Other/print-changed-deleted.ll


Index: llvm/test/Other/print-changed-deleted.ll
===================================================================
--- /dev/null
+++ llvm/test/Other/print-changed-deleted.ll
@@ -0,0 +1,7 @@
+; RUN: opt -passes=globaldce < %s -disable-output -print-changed -filter-print-funcs=f 2>&1 | FileCheck %s
+
+; CHECK-NOT: IR Dump After GlobalDCEPass
+; CHECK: IR Deleted After GlobalDCEPass
+; CHECK-NOT: IR Dump After GlobalDCEPass
+
+declare void @f()
Index: llvm/lib/Passes/StandardInstrumentations.cpp
===================================================================
--- llvm/lib/Passes/StandardInstrumentations.cpp
+++ llvm/lib/Passes/StandardInstrumentations.cpp
@@ -540,6 +540,13 @@
 void IRChangedPrinter::handleAfter(StringRef PassID, std::string &Name,
                                    const std::string &Before,
                                    const std::string &After, Any) {
+  // We might not get anything to print if we only want to print a specific
+  // function but it gets deleted.
+  if (After.empty()) {
+    Out << "*** IR Deleted After " << PassID << Name << " ***\n";
+    return;
+  }
+
   assert(After.find("*** IR Dump") == 0 && "Unexpected banner format.");
   StringRef AfterRef = After;
   StringRef Banner =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100237.336920.patch
Type: text/x-patch
Size: 1242 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210412/0d97907f/attachment.bin>


More information about the llvm-commits mailing list