[PATCH] Fix POW2 histogram

Martin Liška mliska@suse.cz
Mon Aug 8 16:56:00 GMT 2016


Hello.

Currently, we utilize pow2 profile histogram to track gimple STMTs like this: ssa_name_x % value.

void
__gcov_pow2_profiler (gcov_type *counters, gcov_type value)
{
  if (value & (value - 1))
    counters[0]++;
  else
    counters[1]++;
}

Although __gcov_pow2_profiler function wrongly handles 0 (which is not power of two), it's impossible
to write a test-case which would not expose a division by zero. As one can potentially use the same profiler
for a different purpose, I would like to fix it. Apart from that, we've got a small bug in a dump function
of the POW2 histograms.

Survives make check -k -j10 RUNTESTFLAGS="tree-prof.exp"
Ready for trunk?

Thanks,
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Fix-POW2-histogram.patch
Type: text/x-patch
Size: 2461 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160808/912d0487/attachment.bin>


More information about the Gcc-patches mailing list