public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Hubicka <hubicka@ucw.cz>
To: marxin <mliska@suse.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH 2/3] Make early return predictor more precise.
Date: Fri, 09 Jun 2017 14:08:00 -0000	[thread overview]
Message-ID: <20170609140804.GI53583@kam.mff.cuni.cz> (raw)
In-Reply-To: <e8bdc35929a3f9bd2d57e198b5e9343e3c91df2c.1496739572.git.mliska@suse.cz>

> gcc/ChangeLog:
> 
> 2017-05-26  Martin Liska  <mliska@suse.cz>
> 
> 	PR tree-optimization/79489
> 	* gimplify.c (maybe_add_early_return_predict_stmt): New
> 	function.
> 	(gimplify_return_expr): Call the function.
> 	* predict.c (tree_estimate_probability_bb): Remove handling
> 	of early return.
> 	* predict.def: Update comment about early return predictor.
> 	* gimple-predict.h (is_gimple_predict): New function.
> 	* tree-inline.c (remap_gimple_stmt): Do not copy early return
> 	predictors during inlining.
> 	* predict.def: Change default value of early return to 66.

Thanks for working on this.
Doing tail recursion early is quite useful.  Can't we make the pass to
skip predict statements in analysis similar was as debug statements are
skipped?
> diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
> index f3ec404ef09..3f3813cb062 100644
> --- a/gcc/tree-inline.c
> +++ b/gcc/tree-inline.c
> @@ -1629,6 +1629,13 @@ remap_gimple_stmt (gimple *stmt, copy_body_data *id)
>  	  gimple_seq_add_stmt (&stmts, copy);
>  	  return stmts;
>  	}
> +      if (is_gimple_predict (stmt))
> +	{
> +	  /* Do not copy early return predictor that does not make sense
> +	     after inlining.  */
> +	  if (gimple_predict_predictor (stmt) == PRED_TREE_EARLY_RETURN)
> +	    return stmts;
> +	}

I am also not quite sure about this one.  The code was still structured in a way
there was early return in the inlined function, so we may still assume that 
the heuristic works for it?

Where did you found this case?
Honza
>  
>        /* Create a new deep copy of the statement.  */
>        copy = gimple_copy (stmt);
> -- 
> 2.13.0
> 

  reply	other threads:[~2017-06-09 14:08 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-06  9:05 [PATCH 0/3] Rework early return and hot/cold label predictors marxin
2017-06-06  9:05 ` [PATCH 1/3] Come up with selftests for predict.c marxin
2017-06-06 10:44   ` David Malcolm
2017-06-08 12:30     ` Martin Liška
2017-06-08 13:09       ` David Malcolm
2017-06-08 23:07       ` Jan Hubicka
2017-06-06  9:05 ` [PATCH 2/3] Make early return predictor more precise marxin
2017-06-09 14:08   ` Jan Hubicka [this message]
2017-06-13 10:59     ` Martin Liška
2017-06-19 11:11       ` Jan Hubicka
2017-06-20 12:13         ` Martin Liška
2017-06-21  8:27           ` Jan Hubicka
2017-06-21 12:50             ` Martin Liška
2017-06-22 10:48               ` [PATCH] Fix ipa-split-5.c test-case Martin Liška
2017-06-22 14:14               ` [PATCH 2/3] Make early return predictor more precise Christophe Lyon
2017-06-23  7:03                 ` Martin Liška
2017-06-23  7:40                   ` Christophe Lyon
2017-06-06  9:05 ` [PATCH 3/3] Rework cold and hot label attributes in predict.c marxin
2017-06-09 14:04   ` Jan Hubicka
2017-06-21 13:06 ` [PATCH 4/N] Recover GOTO predictor Martin Liška
2017-06-21 13:09   ` Martin Liška
2017-06-22 10:27   ` Richard Biener
2017-06-22 10:57     ` Martin Liška
2017-06-22 11:47       ` Richard Biener
2017-06-30  9:24         ` Martin Liška
2017-06-30 12:37           ` Jan Hubicka
2017-06-30 13:48     ` Martin Liška
2017-07-31  7:47       ` Martin Liška
2017-07-31  8:55         ` Richard Biener

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=20170609140804.GI53583@kam.mff.cuni.cz \
    --to=hubicka@ucw.cz \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mliska@suse.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).