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 <prathameshk@nvidia.com>
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;