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

Easwaran Raman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 11 10:53:38 PDT 2017


eraman 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
----------------
tejohnson wrote:
> 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.
Yes, that's what I should've written.  As long as we have function entry counts, we should return the profile count.


https://reviews.llvm.org/D32877





More information about the llvm-commits mailing list