Move MaxFunctionCount and NumFunctions to the base class. This allows to get max function count from profile summary (which is needed to phase out MaxFunctionCount module flag) without knowing what format of profile is used. I have retained all the existing interfaces in SampleProfSummary (so, for instance, getMaxHeadSamples and getMaxFunctionCount would return the same thing).
Details
Diff Detail
Event Timeline
My original change had a bug due to the fact that sample profile head samples are also counted in body samples (I couldn't run the tests yesterday since the head was broken). I had to undo some of the refactoring from my original patch, but the main stuff - moving max function count and num functions to the base class - still remains the same. I have tested this.
That'll definitely make it consistent with instrumented profile and I'll let Diego chime in. However, that should be a separate patch.
I'm surprised that body samples count header samples. That seems like a bug to me. Easwaran, making both instrumented and sample consistent is a good idea. Thanks.
LGTM
include/llvm/ProfileData/ProfileCommon.h | ||
---|---|---|
153 | Perhaps we should deprecate getMaxHeadSamples? IIUC, MaxFunctionCount is the number of times a function was called, correct? That's essentially the same information provided by counting the number of samples in the function header. There is a difference between the two, but I don't think the distinction is worth keeping. Dehao, what do you think? |
include/llvm/ProfileData/ProfileCommon.h | ||
---|---|---|
153 | Agree, MaxHeadSamples should be the same as MaxFunctionCount. |
include/llvm/ProfileData/ProfileCommon.h | ||
---|---|---|
153 | I thought it is useful in terms of readability to have interfaces named in SampleProfile specific terms. Both MaxHeadSamples and MaxFunctionCount are indeed same and hence getMaxHeadSamples returns the MaxFunctionCount. If this is causing confusion, I'll deprecate this in a separate change. |
Perhaps we should deprecate getMaxHeadSamples? IIUC, MaxFunctionCount is the number of times a function was called, correct? That's essentially the same information provided by counting the number of samples in the function header.
There is a difference between the two, but I don't think the distinction is worth keeping. Dehao, what do you think?