[PATCH] D40425: Extending CFGPrinter and CallPrinter with Heat Colors

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 10:54:35 PST 2017


davidxl added inline comments.


================
Comment at: lib/Analysis/CallPrinter.cpp:58
+
+  CallGraphDOTInfo(Module *M, CallGraph *CG,
+                   function_ref<BlockFrequencyInfo *(Function &)> LookupBFI) {
----------------
Consider templatizing this so that it works for LazyCallGraph too.


================
Comment at: lib/Analysis/CallPrinter.cpp:201
+    uint64_t counter = getNumOfCalls(*F, *SuccFunction, CGInfo->LookupBFI);
+    std::string Attrs = "label=\"" + std::to_string(counter) + "\"";
+    return Attrs;
----------------
How about add color attribute to call edges too -- especially when full graph is displayed?


================
Comment at: lib/Analysis/HeatUtils.cpp:64
+
+uint64_t getNumOfCalls(Function &callerFunction, Function &calledFunction,
+                       function_ref<BlockFrequencyInfo *(Function &)> LookupBFI,
----------------
This is not correct when FullCallGraph is displayed.

In that case, you just need to get the callSite instruction and get its parent BB's frequency.


Repository:
  rL LLVM

https://reviews.llvm.org/D40425





More information about the llvm-commits mailing list