[llvm] [LegacyPM][CGSCC] Print banner with newline when filter-print-funcs is given. (PR #153699)

Tyler Lanphear via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 14 17:49:57 PDT 2025


================
@@ -701,12 +700,11 @@ namespace {
           }
         } else if (isFunctionInPrintList("*")) {
           PrintBannerOnce();
-          OS << "\nPrinting <null> Function\n";
+          OS << "Printing <null> Function\n";
----------------
tylanphear wrote:

That's true. I didn't think about this edge case (personally I don't see much use to `-filter-print-funcs='*'` -- but the behavior does still exist!). So if there are multiple `<null>` functions and we pass `-filter-print-funcs='*'` then instead of
```
*** IR Dump After ... ***
Printing <null> Function

Printing <null> Function

Printing <null> Function
*** IR Dump After ... ***
```

then instead we'd see
```
*** IR Dump After ... ***
Printing <null> Function
Printing <null> Function
Printing <null> Function
*** IR Dump After ... ***
```

I don't have a strong preference for either, but perhaps we could add the newline back as a trailing newline instead? Then we'd see

```
*** IR Dump After ... ***
Printing <null> Function

Printing <null> Function

Printing <null> Function

*** IR Dump After ... ***
```

This is all probably solvable with `ListSeparator` but I didn't feel like going to the trouble of figuring it out. Just threw together a quick patch after seeing some weirdness in some IR dumps ;)

https://github.com/llvm/llvm-project/pull/153699


More information about the llvm-commits mailing list