public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-2101] Fix profile of forwarders produced by cd-dce
@ 2023-06-26 16:30 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2023-06-26 16:30 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:c2ebccc97190a978a44e341516b488f02a78c598

commit r14-2101-gc2ebccc97190a978a44e341516b488f02a78c598
Author: Jan Hubicka <jh@suse.cz>
Date:   Mon Jun 26 18:29:39 2023 +0200

    Fix profile of forwarders produced by cd-dce
    
    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.
    
    gcc/ChangeLog:
    
            PR tree-optimization/109849
            * tree-ssa-dce.cc (make_forwarders_with_degenerate_phis): Fix profile
            count of newly constructed forwarder block.

Diff:
---
 gcc/tree-ssa-dce.cc | 3 +++
 1 file changed, 3 insertions(+)

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]);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-06-26 16:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-26 16:30 [gcc r14-2101] Fix profile of forwarders produced by cd-dce Jan Hubicka

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).