This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Improve predictions for hot and cold labels ([[likely]], [[unlikely]]).
- From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org,Martin Liška <mliska at suse dot cz>
- Cc: Jason Merrill <jason at redhat dot com>,Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 06 Dec 2018 09:23:56 +0100
- Subject: Re: [PATCH] Improve predictions for hot and cold labels ([[likely]], [[unlikely]]).
- References: <cbe66900-a132-7157-99f1-765c43368295@suse.cz>
On 30 November 2018 10:47:45 CET, "Martin Liška" <mliska@suse.cz> wrote:
>Hi.
>
>This patch is a reaction to Jason's commit where he introduced new C++
>attributes.
>First I would like to align cold/hot to __builtin_expect, so I adjusted
>probability
>and made the predictors first match predictors.
>
>Second I fixed how we consider the predictors in switch statements, so
>that
>we can correctly predict situation in predict-3.
>
>Honza is fine with the patch, I'll install it later if there are no
>objections.
>Survives tests and bootstrap on xc86_64-linux-gnu.
I don't have the sources at hand but in:
+/* Branches to hot labels are likely. */
+DEF_PREDICTOR (PRED_HOT_LABEL, "hot label", HITRATE (90),
+ PRED_FLAG_FIRST_MATCH)
+
+/* Branches to cold labels are extremely unlikely. */
+DEF_PREDICTOR (PRED_COLD_LABEL, "cold label", HITRATE (90),
+ PRED_FLAG_FIRST_MATCH)
+
I would have expected cold labels to have a rather low hitrate, like maybe 2 or 7, not 90 ?
Thanks,