[PATCH AutoFDO/2]Treat ZERO as common profile probability/count
bin.cheng
bin.cheng@linux.alibaba.com
Wed Oct 31 08:33:00 GMT 2018
Hi,
In new profile probability/count infra, we have different precision quality categories,
and probabilities/counts of different categories are not supposed to be compared or
calculated. Though in general is an improvement, it introduces unexpected behavior.
Specifically, class profile_probablity and profile_count themselves are implemented
by comparing probabilities/counts against profile_count::zero(). while zero() is of
profile_precision category, it's always compared different to zero of other precision
categories including afdo.
I can see two ways fixing this: 1) Treat zero as a common probability/count regardless
of its category; 2) Provide an "is_zero" method rather than relying on "==" comparison
against probability_count::zero(). 2) requires lots of code changes so I went with 1)
in this patch set. This patch doesn't handle "always" but it might be.
This patch also corrects a minor issue where we try to invert an uninitialized value.
Bootstrap and test on x86_64 in patch set. Is it OK?
Thanks,
bin
2018-10-31 Bin Cheng <bin.cheng@linux.alibaba.com>
* expmed.c (emit_store_flag_force): Use profile_probability::always.
* profile-count.h (profile_probability::always): Add parameter.
(profile_probability::operator==, profile_count::operator==): Treat
ZERO as common probability/count regardless of its quality.
(profile_probability::invert): Don't invert uninitialized probability.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Handle-ZERO-profile-count-prob-as-a-general-value-fo.patch
Type: application/octet-stream
Size: 2760 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20181031/4f34f039/attachment.obj>
More information about the Gcc-patches
mailing list