[PATCH] D11605: [LoopUnswitch] Add block frequency analysis to recognize hot/cold regions
Chen Li via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 12:10:39 PDT 2015
> On Sep 10, 2015, at 12:04 PM, Xinliang David Li <davidxl at google.com> wrote:
>
> Right. I won't trust static profile data to tell you what is cold or hot.
>
> In fact I think the right way to determine coldness is to use the
> actual profile count of the loop header to determine loop is cold or
> not -- the actual exec count of a loop header can be computed by
> multiplying the relative frequency with the the F.getEntryCount(). A
> common threshold can be 0 or 1, which means the loop rarely executes.
That makes sense. I will introduce profile count in an improvement patch later.
thanks,
chen
>
> David
>
>
>
> On Thu, Sep 10, 2015 at 11:48 AM, Chen Li <meloli87 at gmail.com> wrote:
>> chenli added inline comments.
>>
>> ================
>> Comment at: lib/Transforms/Scalar/LoopUnswitch.cpp:441
>> @@ +440,3 @@
>> +
>> + if (LoopUnswitchWithBlockFrequency) {
>> + BranchProbabilityInfo BPI(*F, *LI);
>> ----------------
>> davidxl wrote:
>>> Note that this also triggers the check when PGO is not enabled (e.g, with static prediction).
>>>
>>> To check if PGO is on, do:
>>>
>>> HasProfileData = F.getEntryCount().hasValue();
>>> if (HasProfileData) {
>>>
>>> ..
>> Do you mean that without PGO enabled, this should never be triggered?
>>
>>
>> http://reviews.llvm.org/D11605
>>
>>
>>
More information about the llvm-commits
mailing list