* Fix profile updatin in tree-ssa-threadupdate
@ 2019-12-05 10:12 Jan Hubicka
2019-12-06 22:11 ` Jeff Law
0 siblings, 1 reply; 2+ messages in thread
From: Jan Hubicka @ 2019-12-05 10:12 UTC (permalink / raw)
To: law, gcc-patches
Hi,
this patch makes tree-ssa-threadupdate to not leave basic blocks with
undefined counts in the program.
create_block_for_threading sets counts as follows:
/* Zero out the profile, since the block is unreachable for now. */
rd->dup_blocks[count]->count = profile_count::uninitialized ();
which is usually set to correct count in update_profile. However
template_blocks are not seen by it and thus this patch calculates the
profile while redirecting edgs to it.
Bootstrapped/regtested x86_64-linux and also checked that the profile is
correct. Does it make sense? There is no testcase since I plan to
commit sanity check that triggers several times during the testsuite and
bootstrap w/o this patch.
Honza
* tree-ssa-threadupdate.c
Index: tree-ssa-threadupdate.c
===================================================================
--- tree-ssa-threadupdate.c (revision 278959)
+++ tree-ssa-threadupdate.c (working copy)
@@ -1286,6 +1286,10 @@ ssa_redirect_edges (struct redirection_d
/* Redirect the incoming edge (possibly to the joiner block) to the
appropriate duplicate block. */
e2 = redirect_edge_and_branch (e, rd->dup_blocks[0]);
+ if (single_pred_p (rd->dup_blocks[0]))
+ rd->dup_blocks[0]->count = e2->count ();
+ else
+ rd->dup_blocks[0]->count = rd->dup_blocks[0]->count + e2->count ();
gcc_assert (e == e2);
flush_pending_stmts (e2);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fix profile updatin in tree-ssa-threadupdate
2019-12-05 10:12 Fix profile updatin in tree-ssa-threadupdate Jan Hubicka
@ 2019-12-06 22:11 ` Jeff Law
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Law @ 2019-12-06 22:11 UTC (permalink / raw)
To: Jan Hubicka, gcc-patches
On Thu, 2019-12-05 at 11:12 +0100, Jan Hubicka wrote:
> Hi,
> this patch makes tree-ssa-threadupdate to not leave basic blocks with
> undefined counts in the program.
>
> create_block_for_threading sets counts as follows:
>
> /* Zero out the profile, since the block is unreachable for
> now. */
> rd->dup_blocks[count]->count = profile_count::uninitialized ();
>
> which is usually set to correct count in update_profile. However
> template_blocks are not seen by it and thus this patch calculates the
> profile while redirecting edgs to it.
>
> Bootstrapped/regtested x86_64-linux and also checked that the profile
> is
> correct. Does it make sense? There is no testcase since I plan to
> commit sanity check that triggers several times during the testsuite
> and
> bootstrap w/o this patch.
I would have expected a call to update_profile even in the case of the
template block.
ISTM we would call ssa_fixup_template_block, which in turn would call
ssa_fix_duplicate_block_edges which in turn would have called
update_profile.
jeff
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-06 22:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 10:12 Fix profile updatin in tree-ssa-threadupdate Jan Hubicka
2019-12-06 22:11 ` Jeff Law
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).