public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Fix profile_count::to_sreal_scale
@ 2023-07-26  7:01 Jan Hubicka
  0 siblings, 0 replies; only message in thread
From: Jan Hubicka @ 2023-07-26  7:01 UTC (permalink / raw)
  To: gcc-patches

Hi,
this patch makes profile_count::to_sreal_scale consider the scale
unknown when in is 0.  This fixes the case where loop has 0 executions
in profile feedback and thus we can't determine its trip count.

Bootstrapped/regtested x86_64-linux, comitted.

Honza

gcc/ChangeLog:

	* profile-count.cc (profile_count::to_sreal_scale): Value is not know
	if we divide by zero.

diff --git a/gcc/profile-count.cc b/gcc/profile-count.cc
index 2c07ebc5942..eaf0f0d787e 100644
--- a/gcc/profile-count.cc
+++ b/gcc/profile-count.cc
@@ -345,7 +345,7 @@ profile_count::to_sreal_scale (profile_count in, bool *known) const
       return 1;
     }
   if (known)
-    *known = true;
+    *known = in.m_val != 0;
   if (*this == in)
     return 1;
   gcc_checking_assert (compatible_p (in));

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-26  7:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-26  7:01 Fix profile_count::to_sreal_scale 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).