]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix cs_interesting_for_ipcp_p wrt flag_profile_partial_training.
authorJan Hubicka <hubicka@ucw.cz>
Tue, 29 Apr 2025 20:43:45 +0000 (22:43 +0200)
committerJan Hubicka <hubicka@ucw.cz>
Tue, 29 Apr 2025 20:43:45 +0000 (22:43 +0200)
As noticed by Martin Jambor, I introduced a bug while simplifying
cs_interesting_for_ipcp_p and reversed condition for
flag_profile_partial_training.  Also I noticed that we probably want to
consider calls with unintialized counts for cloning so the pass does somehting
with -fno-guess-branch-probability even thugh this is probably not very useful
in practice.

gcc/ChangeLog:

* ipa-cp.cc (cs_interesting_for_ipcp_p): Fix handling of uninitialized
counts and 0 IPA cost wrt flag_profile_partial_training.

gcc/ipa-cp.cc

index b4b96997d750e14c8d3f0380ddc401ce5e6aeb47..f7e5aa9bfd5cdefd789d82c16e79c67985110419 100644 (file)
@@ -545,14 +545,12 @@ cs_interesting_for_ipcp_p (cgraph_edge *e)
     return true;
   /* If local (possibly guseed or adjusted 0 profile) claims edge is
      not executed, do not propagate.  */
-  if (!e->count.nonzero_p ())
+  if (e->count.initialized_p () && !e->count.nonzero_p ())
     return false;
-  /* If IPA profile says edge is executed zero times, but zero
-     is quality is ADJUSTED, still consider it for cloning in
-     case we have partial training.  */
+  /* If we have zero IPA profile, still consider edge for cloning
+     in case we do partial training.  */
   if (e->count.ipa ().initialized_p ()
-      && opt_for_fn (e->callee->decl,flag_profile_partial_training)
-      && e->count.nonzero_p ())
+      && !opt_for_fn (e->callee->decl,flag_profile_partial_training))
     return false;
   return true;
 }