Functions without matched samples receive AutoFDO zero counts but keep
PROFILE_GUESSED status.  Mark them PROFILE_READ so missing profile
repair can propagate through their callees.

Bootstrapped and regression tested on aarch64-linux-gnu.

gcc/ChangeLog:

        * auto-profile.cc (afdo_annotate_cfg): Mark profiles without matched
        samples as PROFILE_READ.

Signed-off-by: Kugan Vivekanandarajah <[email protected]>
---
 gcc/auto-profile.cc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc
index 7fee25fd88a..174c3e86009 100644
--- a/gcc/auto-profile.cc
+++ b/gcc/auto-profile.cc
@@ -4593,6 +4593,7 @@ afdo_annotate_cfg (void)
            if (bb->count.quality () == GUESSED_LOCAL)
              bb->count = bb->count.global0afdo ();
          update_max_bb_count ();
+         profile_status_for_fn (cfun) = PROFILE_READ;
        }
       return;
     }
@@ -4677,6 +4678,7 @@ afdo_annotate_cfg (void)
            if (bb->count.quality () == GUESSED_LOCAL)
              bb->count = bb->count.global0afdo ();
          update_max_bb_count ();
+         profile_status_for_fn (cfun) = PROFILE_READ;
        }
 
       loop_optimizer_finalize ();
-- 
2.34.1

Reply via email to