https://gcc.gnu.org/g:0d23baa527f1fb054e6d321d317db857539a67ec
commit r16-8522-g0d23baa527f1fb054e6d321d317db857539a67ec Author: Prathamesh Kulkarni <[email protected]> Date: Wed Apr 8 05:56:12 2026 +0000 [auto-profile] Improve handling of timestamp merging. The following condition: if (other->timestamp() < timestamp()) set_timestamp (other->timetamp()) would set timestamp() to 0 if other->timestamp() was zero effectively dropping the symbol from time-profile based reordering. The patch fixes this by ensuring other->timestamp() is greater than zero. Also, handles the case when timestamp() is zero but other->timestamp() is non-zero. gcc/ChangeLog: * auto-profile.cc (function_instance::merge): Set other->timestamp() if it's lesser than timestamp() and greater than zero or if timestamp() is zero. Signed-off-by: Prathamesh Kulkarni <[email protected]> Diff: --- gcc/auto-profile.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc index 34f863a77310..f4562d7f2f98 100644 --- a/gcc/auto-profile.cc +++ b/gcc/auto-profile.cc @@ -1372,7 +1372,9 @@ function_instance::merge (function_instance *other, head_count_ += other->head_count_; /* While merging timestamps, set the one that occurs earlier. */ - if (other->timestamp () < timestamp ()) + if (timestamp () == 0 + || (other->timestamp () > 0 + && other->timestamp () < timestamp ())) set_timestamp (other->timestamp ()); bool changed = true;
