http://codereview.appspot.com/6282045/diff/1/gcc/gcov-io.h File gcc/gcov-io.h (right):
http://codereview.appspot.com/6282045/diff/1/gcc/gcov-io.h#newcode544 gcc/gcov-io.h:544: gcov_unsigned_t sum_cutoff_percent;/* sum_all cutoff percentage computed Is there a need to record this? http://codereview.appspot.com/6282045/diff/1/gcc/gcov-io.h#newcode546 gcc/gcov-io.h:546: gcov_unsigned_t num_to_cutoff;/* number of counters to reach above cutoff. */ This should have a better name -- e.g., hot_arc_count. http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c File gcc/loop-unroll.c (right): http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c#newcode196 gcc/loop-unroll.c:196: or peeled loop. */ Add more documentation here: 1) for program size < threshold, do not limit 2) for threshold < psize < 2* threshold, tame the max allows peels/unrolls according to hotness; 3) for huge footprint programs, disable it (by ...). http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c#newcode197 gcc/loop-unroll.c:197: static limit_type Blank line. http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c#newcode233 gcc/loop-unroll.c:233: gcc_assert(profile_info->sum_all > 0); Do not assert on profile data -- either bail or emit info. http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c#newcode237 gcc/loop-unroll.c:237: if (profile_info->num_to_cutoff < size_threshold*2) { space http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c#newcode238 gcc/loop-unroll.c:238: /* For appliations that are less than twice the codesize limit, allow applications http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c#newcode532 gcc/loop-unroll.c:532: limit = limit_code_size(loop, &codesize_divisor); space. http://codereview.appspot.com/6282045/diff/1/gcc/loop-unroll.c#newcode1095 gcc/loop-unroll.c:1095: int codesize_divisor) This parameter is not documented. The name of the parameter is also not ideal -. Is it possible to not change the interfaces? -- i.e., split limit_code_size into two helper functions one to get the the suppress flag as before, and the other gets the limit_factor which is called inside each function 'decide_unroll_runtime...' -- it is cleaner and easier to understand that way. http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c File libgcc/libgcov.c (right): http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode832 libgcc/libgcov.c:832: #define CUM_CUTOFF_PERCENT_TIMES_10 999 Ok now but it should be controllable at compile time with a --param -- recorded in the binary; http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode839 libgcc/libgcov.c:839: for (t_ix = 0; t_ix < GCOV_COUNTERS_SUMMABLE; t_ix++) There does not seem a need for a loop -- only t_ix == GCOV_COUNTER_ARCS is summable. http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode848 libgcc/libgcov.c:848: cum_cutoff = (cs_ptr->sum_all * cutoff_perc)/1000; Overflow possibility? http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode854 libgcc/libgcov.c:854: value_array = (gcov_type *) malloc (sizeof(gcov_type)*cs_ptr->num); space http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode860 libgcc/libgcov.c:860: for (i = 0, ctr_info_ix = 0; i < t_ix; i++) No need for this -- the index for ARC counter is always 0 (add assert) -- so either skip (use merge function for 47 and mask for 46) or use 0. http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode864 libgcc/libgcov.c:864: } in gcc_46 and before, the counters may not be allocated, and it should not directly accessed using t_ix. It needs to be guarded with if ((1 << t_ix) & gi_ptr->ctr_mask) http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode875 libgcc/libgcov.c:875: gcc_assert (index + ci_ptr->num <= cs_ptr->num); Need to relax this a little by skipping -- profiling dumping is known to be 'flaky' http://codereview.appspot.com/6282045/diff/1/libgcc/libgcov.c#newcode1103 libgcc/libgcov.c:1103: cs_prg->sum_max += cs_tprg->run_max; For multiple runs, how should num_to_cutoff merged? Pick the larger value? http://codereview.appspot.com/6282045/