aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2022-06-23 22:59:11 +0200
committerMartin Liska <mliska@suse.cz>2022-06-24 10:43:46 +0200
commit268b5c81e93ac3ff44fc8ace22ce504d8faa4b07 (patch)
tree295aa078ec4e72ccd5f624d9d9d5e636adb08312
parent3b8794302b52a819ca3ea78238e9b5025d1c56dd (diff)
downloadgcc-268b5c81e93ac3ff44fc8ace22ce504d8faa4b07.zip
gcc-268b5c81e93ac3ff44fc8ace22ce504d8faa4b07.tar.gz
gcc-268b5c81e93ac3ff44fc8ace22ce504d8faa4b07.tar.bz2
profile-count: fix /= and *= operators
PR middle-end/106059 gcc/ChangeLog: * profile-count.h: *= and /= operators need to modify this object.
-rw-r--r--gcc/profile-count.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/profile-count.h b/gcc/profile-count.h
index be6e2d5..141a882 100644
--- a/gcc/profile-count.h
+++ b/gcc/profile-count.h
@@ -605,9 +605,10 @@ public:
return apply_scale (num, 1);
}
- profile_probability operator*= (int64_t den) const
+ profile_probability operator*= (int64_t num)
{
- return *this * den;
+ *this = apply_scale (num, 1);
+ return *this;
}
profile_probability operator/ (int64_t den) const
@@ -615,9 +616,10 @@ public:
return apply_scale (1, den);
}
- profile_probability operator/= (int64_t den) const
+ profile_probability operator/= (int64_t den)
{
- return *this / den;
+ *this = apply_scale (1, den);
+ return *this;
}
/* Get the value of the count. */
@@ -1017,9 +1019,10 @@ public:
return apply_scale (num, 1);
}
- profile_count operator*= (int64_t den) const
+ profile_count operator*= (int64_t num)
{
- return *this * den;
+ *this = apply_scale (num, 1);
+ return *this;
}
profile_count operator/ (int64_t den) const
@@ -1027,9 +1030,10 @@ public:
return apply_scale (1, den);
}
- profile_count operator/= (int64_t den) const
+ profile_count operator/= (int64_t den)
{
- return *this / den;
+ *this = apply_scale (1, den);
+ return *this;
}
/* Return true when value is not zero and can be used for scaling.