On Dez 08 2019, Jan Hubicka wrote: > Index: cgraphunit.c > =================================================================== > --- cgraphunit.c (revision 279076) > +++ cgraphunit.c (working copy) > @@ -2359,19 +2359,33 @@ cgraph_node::expand (void) > /* Node comparator that is responsible for the order that corresponds > to time when a function was launched for the first time. */ > > -static int > -node_cmp (const void *pa, const void *pb) > +int > +tp_first_run_node_cmp (const void *pa, const void *pb) > { > const cgraph_node *a = *(const cgraph_node * const *) pa; > const cgraph_node *b = *(const cgraph_node * const *) pb; > + gcov_type tp_first_run_a = a->tp_first_run; > + gcov_type tp_first_run_b = b->tp_first_run; > + > + if (!opt_for_fn (a->decl, flag_profile_reorder_functions) > + || a->no_reorder) > + tp_first_run_a = 0; > + if (!opt_for_fn (b->decl, flag_profile_reorder_functions) > + || b->no_reorder) > + tp_first_run_b = 0; > + > + if (tp_first_run_a == tp_first_run_b) > + return b->order - a->order; > > /* Functions with time profile must be before these without profile. */ > - if (!a->tp_first_run || !b->tp_first_run) > - return a->tp_first_run - b->tp_first_run; > + if (!tp_first_run_a || !tp_first_run_b) > + return tp_first_run_a ? 1 : -1; > > - return a->tp_first_run != b->tp_first_run > - ? b->tp_first_run - a->tp_first_run > - : b->order - a->order; > + /* Watch for overlflow - tp_first_run is 64bit. */ overflow
Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."