1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

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

-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.

Reviewed By: jamieschmeiser

Differential Revision: https://reviews.llvm.org/D100237
This commit is contained in:
Arthur Eubanks 2021-04-09 14:13:29 -07:00
parent d0439c9121
commit dabbc4dc8d
2 changed files with 14 additions and 0 deletions

View File

@ -540,6 +540,13 @@ void IRChangedPrinter::generateIRRepresentation(Any IR, StringRef PassID,
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 =

View File

@ -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()