public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <rguenther@suse.de>
To: Jan Hubicka <hubicka@ucw.cz>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: Fix profile of forwardes produced by cd-dce
Date: Tue, 27 Jun 2023 06:35:08 +0000 (UTC)	[thread overview]
Message-ID: <nycvar.YFH.7.77.849.2306270634510.4723@jbgna.fhfr.qr> (raw)
In-Reply-To: <ZJm82eCPnJ4r8nrP@kam.mff.cuni.cz>

On Mon, 26 Jun 2023, Jan Hubicka wrote:

> Hi,
> compiling the testcase from PR109849 (which uses std:vector based stack to
> drive a loop) with profile feedbakc leads to profile mismatches introduced by
> tree-ssa-dce.  This is the new code to produce unified forwarder blocks for
> PHIs.
> 
> I am not including the testcase itself since
> checking it for Invalid sum is probably going to be too fragile and this should
> show in our LNT testers. The patch however fixes the mismatch.
> 
> Bootstrapped/regtested x86_64-linux and plan to commit it shortly.

Thanks - can you also fix affected branches?

Richard.

> gcc/ChangeLog:
> 
> 	PR tree-optimization/109849
> 	* tree-ssa-dce.cc (make_forwarders_with_degenerate_phis): Fix profile
> 	count of newly constructed forwarder block.
> 
> diff --git a/gcc/tree-ssa-dce.cc b/gcc/tree-ssa-dce.cc
> index 2949957f883..f0b02456132 100644
> --- a/gcc/tree-ssa-dce.cc
> +++ b/gcc/tree-ssa-dce.cc
> @@ -1865,12 +1865,15 @@ make_forwarders_with_degenerate_phis (function *fn)
>  		    }
>  		  free_dominance_info (fn, CDI_DOMINATORS);
>  		  basic_block forwarder = split_edge (args[start].first);
> +		  profile_count count = profile_count::zero ();
>  		  for (unsigned j = start + 1; j < i; ++j)
>  		    {
>  		      edge e = args[j].first;
>  		      redirect_edge_and_branch_force (e, forwarder);
>  		      redirect_edge_var_map_clear (e);
> +		      count += e->count ();
>  		    }
> +		  forwarder->count = count;
>  		  if (vphi)
>  		    {
>  		      tree def = copy_ssa_name (vphi_args[0]);
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg,
Germany; GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman;
HRB 36809 (AG Nuernberg)

      reply	other threads:[~2023-06-27  6:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 16:29 Jan Hubicka
2023-06-27  6:35 ` Richard Biener [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=nycvar.YFH.7.77.849.2306270634510.4723@jbgna.fhfr.qr \
    --to=rguenther@suse.de \
    --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).