// David

For value profiling transformation to kick in, gcc requires value histogram to
have a value with dominating count. However, another heuristic that can be used
is  to check if the total number of values is small, for instance 2.

 The following progrma shows the problem:

//
#include <string.h>


void mycpy (char* s1, char *s2, int n) __attribute__((noinline));
void mycpy (char* s1, char *s2, int n)
{
  memcpy(s1,s2,n);
}


int main()
{

   char *s1 = malloc(100000);
   char *s2 = malloc(100000);
   int i;

   for ( i = 0 ; i < 100000; i ++)
   {
        mycpy(s1,s2, i%2 ? 128:64);
   }

}


-- 
           Summary: value profiling tuning
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: xinliangli at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35591

Reply via email to