[PATCH] D73142: Heat Coloring for CFGPrinter and CallPrinter

David Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 10:02:18 PST 2020


davidxl added inline comments.


================
Comment at: llvm/lib/Analysis/HeatUtils.cpp:39
+bool hasProfiling(const Module &M) {
+  for (auto &F : M) {
+    for (auto &BB : F) {
----------------
You can use ProfileSummaryInfo::hasProfileSummary interface.


================
Comment at: llvm/lib/Analysis/HeatUtils.cpp:66
+                       function_ref<BlockFrequencyInfo *(Function &)> LookupBFI,
+                       bool useHeuristic) {
+  if (CS.getInstruction()==nullptr) return 0;
----------------
parameter not used


================
Comment at: llvm/lib/Analysis/HeatUtils.cpp:67
+                       bool useHeuristic) {
+  if (CS.getInstruction()==nullptr) return 0;
+  if (CS.getInstruction()->getParent()==nullptr) return 0;
----------------
clang-format


================
Comment at: llvm/lib/Analysis/HeatUtils.cpp:73
+
+uint64_t getNumOfCalls(Function &callerFunction, Function &calledFunction,
+                       function_ref<BlockFrequencyInfo *(Function &)> LookupBFI,
----------------
The function entry count should have the information


================
Comment at: llvm/lib/Analysis/HeatUtils.cpp:99
+
+uint64_t getMaxFreq(Module &M,
+                    function_ref<BlockFrequencyInfo *(Function &)> LookupBFI,
----------------
for the program's max count, max function count, get it from ProfileSummaryInfo.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73142/new/

https://reviews.llvm.org/D73142





More information about the llvm-commits mailing list