diff mbox series

Fix profile_count::to_sreal_scale

Message ID ZMDEwXtgcXt8s3kE@kam.mff.cuni.cz
State New
Headers show
Series Fix profile_count::to_sreal_scale | expand

Commit Message

Jan Hubicka July 26, 2023, 7:01 a.m. UTC
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 mbox series

Patch

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));