* Fix updating of probabilities in update_bb_profile_for_threading
@ 2017-01-21 20:15 Jan Hubicka
0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2017-01-21 20:15 UTC (permalink / raw)
To: gcc-patches
Hi,
this is another small fix to improve upatting fater profile.
update_bb_profile_for_threading was buggy in years by computing
probability before updating frequency.
Moreover for bugus profiles it is better to avoid dropping count
to complete 0 because that implies optimization for size.
Bootstrapped/regtested x86_64-linux,c omitted.
Honza
Index: ChangeLog
===================================================================
--- ChangeLog (revision 244748)
+++ ChangeLog (working copy)
@@ -1,3 +1,8 @@
+2017-01-21 Jan Hubicka <hubicka@ucw.cz>
+
+ PR lto/78407
+ * cfg.c (update_bb_profile_for_threading): Fix updating of probablity.
+
2017-01-21 Bernd Schmidt <bschmidt@redhat.com>
rtl-optimization/79125
Index: cfg.c
===================================================================
--- cfg.c (revision 244732)
+++ cfg.c (working copy)
@@ -869,6 +869,10 @@ update_bb_profile_for_threading (basic_b
bb->count = 0;
}
+ bb->frequency -= edge_frequency;
+ if (bb->frequency < 0)
+ bb->frequency = 0;
+
/* Compute the probability of TAKEN_EDGE being reached via threaded edge.
Watch for overflows. */
if (bb->frequency)
@@ -882,15 +886,12 @@ update_bb_profile_for_threading (basic_b
"%i->%i too small (it is %i, should be %i).\n",
taken_edge->src->index, taken_edge->dest->index,
taken_edge->probability, prob);
- prob = taken_edge->probability;
+ prob = taken_edge->probability * 6 / 8;
}
/* Now rescale the probabilities. */
taken_edge->probability -= prob;
prob = REG_BR_PROB_BASE - prob;
- bb->frequency -= edge_frequency;
- if (bb->frequency < 0)
- bb->frequency = 0;
if (prob <= 0)
{
if (dump_file)
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-01-21 19:38 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-21 20:15 Fix updating of probabilities in update_bb_profile_for_threading 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).