[PATCH] D45377: [SampleFDO] Don't let inliner treat warm callsite with inline instance in the profile as cold

Wei Mi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 11 10:00:17 PDT 2018


wmi added inline comments.


================
Comment at: lib/Analysis/ProfileSummaryInfo.cpp:252
   return (hasSampleProfile() &&
-          (CS.getCaller()->hasProfileData() || ProfileSampleAccurate ||
+          (ProfileSampleAccurate ||
            CS.getCaller()->hasFnAttribute("profile-sample-accurate")));
----------------
davidxl wrote:
> This can cause problem if the caller function is newly added and there is no profile associated with it -- all callsites there will be marked as cold.
You are right. That is a problem. Need to figure out how to avoid it.


================
Comment at: lib/Transforms/IPO/SampleProfile.cpp:1300
+        // so that regular inliner will not treat it as cold.
+        if (BlockWeights[BB] == 0 && WarmCallsWithoutProf.count(&I))
+          continue;
----------------
davidxl wrote:
> Instead of skipping it, is it better to annotate it with a 'warm' profile count?
I considered that solution but I was worried that by annotating the callsite with warm profile count, it will be treated as warm but the callsites inside of the callee will still be treated as cold after the current callsite is inlined. 

Definitely the issue here I am worried about is minor than the missing profile issue of new functions introduced by source change.  I think this is still a good solution if only the testing is fine, or if we can come up with better solution.


Repository:
  rL LLVM

https://reviews.llvm.org/D45377





More information about the llvm-commits mailing list