[PATCH] D32877: Restrict call metadata based hotness detection to Sample PGO mode

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 18:58:43 PDT 2017


tejohnson added inline comments.


================
Comment at: lib/Analysis/ProfileSummaryInfo.cpp:80
          "We can only get profile count for call/invoke instruction.");
-  // Check if there is a profile metadata on the instruction. If it is present,
-  // determine hotness solely based on that.
-  uint64_t TotalCount;
-  if (Inst->extractProfTotalWeight(TotalCount))
-    return TotalCount;
+  if (Summary->getKind() == ProfileSummary::PSK_Sample) {
+    // In sample PGO mode, check if there is a profile metadata on the
----------------
eraman wrote:
> I wonder if we should check if Summary is non-null and then the summary kind is PSK_Sample. There is one test case down below (inliner count update) where you had to attach the summary to the test case. Is there any reason the summary has to be present to get the count based on entry count and block frequency?
Do you mean only do the metadata-based hotness when computeSummary() returns true and the kind is PSK_Sample? I.e. if !computeSummary(), then assume instrumentation based? I could do that, it would mean a few less test changes.


https://reviews.llvm.org/D32877





More information about the llvm-commits mailing list