[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
Fri Apr 9 16:10:25 PDT 2021
aeubanks created this revision.
Herald added a subscriber: hiraditya.
aeubanks requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
-filter-print-funcs -print-changed was crashing after the filter func
was removed by a pass with
Assertion failed: After.find("*** IR Dump") == 0 && "Unexpected banner format."
We weren't printing the banner because when we have -filter-print-funcs,
we print each function separately, letting the print function filter out
unwanted functions.
Repository:
rG LLVM Github Monorepo
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,5 @@
+; RUN: opt -passes=globaldce < %s -disable-output -print-changed -filter-print-funcs=f 2>&1 | FileCheck %s
+
+; 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,10 @@
void IRChangedPrinter::handleAfter(StringRef PassID, std::string &Name,
const std::string &Before,
const std::string &After, Any) {
+ // We might not have anything to print if we only want to print a specific
+ // function but it gets deleted.
+ if (After.empty())
+ 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.336578.patch
Type: text/x-patch
Size: 1084 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210409/ede3dd84/attachment.bin>
More information about the llvm-commits
mailing list