From: "Martin Liška" <mliska@suse.cz>
To: Jan Hubicka <hubicka@ucw.cz>, gcc-patches@gcc.gnu.org
Subject: Re: Fix remove_predictions_associated_with_edge
Date: Mon, 10 Aug 2020 05:00:52 +0200 [thread overview]
Message-ID: <319d3583-dfa8-9935-b5fa-585e25920775@suse.cz> (raw)
In-Reply-To: <20200802130215.GA53029@kam.mff.cuni.cz>
On 8/2/20 3:02 PM, Jan Hubicka wrote:
> Hi,
> remove_predictions_associated_with_edge currently calls filter_predicitons
> passing it equal_edge_p. Becase filter_predictions removes all edges where
> filter returns false, the function does exact oposite. Fixed thus.
>
> Bootstrapped/regtested x86_64-linux.
Thanks for the patch. It seems to me obvious, please install it.
Martin
>
> gcc/ChangeLog:
>
> 2020-08-02 Jan Hubicka <hubicka@ucw.cz>
>
> * predict.c (filter_predictions): Document semantics of filter.
> (equal_edge_p): Rename to ...
> (not_equal_edge_p): ... this; reverse semantics.
> (remove_predictions_associated_with_edge): Fix.
>
> diff --git a/gcc/predict.c b/gcc/predict.c
> index 0a317a7a4ac..2164a06e083 100644
> --- a/gcc/predict.c
> +++ b/gcc/predict.c
> @@ -595,10 +595,11 @@ gimple_predict_edge (edge e, enum br_predictor predictor, int probability)
> }
> }
>
> -/* Filter edge predictions PREDS by a function FILTER. DATA are passed
> - to the filter function. */
> +/* Filter edge predictions PREDS by a function FILTER: if FILTER return false
> + the prediction is removed.
> + DATA are passed to the filter function. */
>
> -void
> +static void
> filter_predictions (edge_prediction **preds,
> bool (*filter) (edge_prediction *, void *), void *data)
> {
> @@ -627,10 +628,10 @@ filter_predictions (edge_prediction **preds,
> /* Filter function predicate that returns true for a edge predicate P
> if its edge is equal to DATA. */
>
> -bool
> -equal_edge_p (edge_prediction *p, void *data)
> +static bool
> +not_equal_edge_p (edge_prediction *p, void *data)
> {
> - return p->ep_edge == (edge)data;
> + return p->ep_edge != (edge)data;
> }
>
> /* Remove all predictions on given basic block that are attached
> @@ -642,7 +643,7 @@ remove_predictions_associated_with_edge (edge e)
> return;
>
> edge_prediction **preds = bb_predictions->get (e->src);
> - filter_predictions (preds, equal_edge_p, e);
> + filter_predictions (preds, not_equal_edge_p, e);
> }
>
> /* Clears the list of predictions stored for BB. */
>
prev parent reply other threads:[~2020-08-10 3:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-02 13:02 Jan Hubicka
2020-08-10 3:00 ` Martin Liška [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=319d3583-dfa8-9935-b5fa-585e25920775@suse.cz \
--to=mliska@suse.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=hubicka@ucw.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).