From: Prathamesh Kulkarni Date: Wed, 8 Apr 2026 05:56:12 +0000 (+0000) Subject: [auto-profile] Improve handling of timestamp merging. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0d23baa527f1fb054e6d321d317db857539a67ec;p=thirdparty%2Fgcc.git [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 --- diff --git a/gcc/auto-profile.cc b/gcc/auto-profile.cc index 34f863a7731..f4562d7f2f9 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;