[gcc(refs/users/pheeck/heads/insert-api)] fixed probabilities in mod_subtract in value-prof.cc
Filip Kastl
pheeck@gcc.gnu.org
Mon Jun 19 14:07:20 GMT 2023
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
{
More information about the Gcc-cvs
mailing list