public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/pheeck/heads/insert-api)] fixed probabilities in mod_subtract in value-prof.cc
@ 2023-06-19 14:07 Filip Kastl
0 siblings, 0 replies; only message in thread
From: Filip Kastl @ 2023-06-19 14:07 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:a84ddc291d8785a73d3759f111a8e6631ca9198e
commit a84ddc291d8785a73d3759f111a8e6631ca9198e
Author: Filip Kastl <filip.kastl@gmail.com>
Date: Tue May 16 12:45:49 2023 +0200
fixed probabilities in mod_subtract in value-prof.cc
Diff:
---
gcc/value-prof.cc | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/gcc/value-prof.cc b/gcc/value-prof.cc
index def8df62860..d529179bdb3 100644
--- a/gcc/value-prof.cc
+++ b/gcc/value-prof.cc
@@ -720,7 +720,7 @@ gimple_divmod_fixed_value (gassign *stmt, tree value, profile_probability prob,
hack_ssa_builder builder;
hvar *op1 = builder.new_invar (gimple_assign_rhs1 (stmt));
hvar *op2 = builder.new_invar (gimple_assign_rhs2 (stmt));
- hvar *value_as_invar = builder.new_invar (value);
+ hvar *value_as_invar = builder.new_invar (fold_convert (optype, value));
hvar *tmp = builder.new_local (optype);
/* bb1. */
@@ -1227,8 +1227,8 @@ gimple_mod_subtract (gassign *stmt, profile_probability prob1,
}
else
{
- e12or13->probability = prob1;
- e14->probability = prob1.invert ();
+ e12or13->probability = prob1.invert ();
+ e14->probability = prob1;
e34->probability = profile_probability::always ();
e45->probability = profile_probability::always ();
bb3->count = profile_count::from_gcov_type (count1);
@@ -1313,7 +1313,11 @@ gimple_mod_subtract_transform (gimple_stmt_iterator *si)
if (all > 0)
{
prob1 = profile_probability::probability_in_gcov_type (count1, all);
- prob2 = profile_probability::probability_in_gcov_type (count2, all);
+ if (all == count1)
+ prob2 = profile_probability::even ();
+ else
+ prob2 = profile_probability::probability_in_gcov_type (count2, all -
+ count1);
}
else
{
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-06-19 14:07 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-19 14:07 [gcc(refs/users/pheeck/heads/insert-api)] fixed probabilities in mod_subtract in value-prof.cc Filip Kastl
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).