[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 13:59:10 PST 2016


tejohnson added inline comments.

================
Comment at: lib/Analysis/CallGraphSCCPass.cpp:616
@@ +615,3 @@
+        if (CGN->getFunction()) {
+          if (isFunctionInPrintList(CGN->getFunction()->getName()))
+            CGN->getFunction()->print(Out);
----------------
Oh I see, we don't want to print anything when the function is suppressed. Nevermind my suggestion then.

================
Comment at: lib/IR/LegacyPassManager.cpp:129
@@ +128,3 @@
+  if (PrintFuncNames.count("*"))
+    return true;
+  return PrintFuncNames.count(FunctionName);
----------------
weimingz wrote:
> joker.eph wrote:
> > I'm not sure I see the need for the "*" in the set? The empty case returning true seems enough to me to provide exactly the same behavior.
> Need that because in Module print, we need to test if the filter-list is empty or not.  (An empty list means the whole module will be printed).
> 
> isFunctionInPrintList() only checks if the argument string is in the list or not. Alternatively, we can let it return a pair of bools, one indicates if the list is empty or not, the other tells if the arg is in list or not. But this is not intuitive. 
How about just return true when PrintFuncNames is empty? I see you are currently using that condition to guard initialization. You can either add a different static bool to indicate that it was already initialized, or key off of PrintFuncsList being non-empty to guard the initialization.

Then you don't need the special case in PrintModulePass::run either.


Repository:
  rL LLVM

http://reviews.llvm.org/D15776





More information about the llvm-commits mailing list