[PATCH] D15776: Filtering IR printing for print-after-all/print-before-all

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 08:04:54 PST 2016


tejohnson added a subscriber: tejohnson.
tejohnson added a comment.

Agree with Mehdi, this will be very useful. Thanks!


================
Comment at: lib/Analysis/CallGraphSCCPass.cpp:616
@@ +615,3 @@
+        if (CGN->getFunction()) {
+          if (isFunctionInPrintList(CGN->getFunction()->getName()))
+            CGN->getFunction()->print(Out);
----------------
Combine above two ifs into a single "if (A && B)".

================
Comment at: lib/IR/IRPrintingPasses.cpp:34
@@ -32,1 +33,3 @@
+  } else
+    OS << Banner << " (skipped printing)\n";
   return PreservedAnalyses::all();
----------------
joker.eph wrote:
> What about having the `else` here looping over the module and finding the functions selected to be printed and print them?
Agree here with Mehdi. Rather than have an all-or-nothing printing of the module under a special "*" string, it would be better to walk the module and print just the functions in the list. Otherwise to get any printing before/after module passes you run into the same issue with huge amounts of output for large modules. This would also be analogous to what you are doing for SCC passes (printing just the functions in the SCC that are in the list).

================
Comment at: lib/IR/LegacyPassManager.cpp:90
@@ +89,3 @@
+                   cl::desc("Print IR only for specified functions. Including "
+                            "'*' prints module passes."),
+                   cl::CommaSeparated);
----------------
Remove the "*" special case as described earlier.


Repository:
  rL LLVM

http://reviews.llvm.org/D15776





More information about the llvm-commits mailing list