The following 2 functions should be compiled to the same assembly. 
This is one of Briggs' compiler benchmarks.

void strength_test10(int *data)
{
  int stop = data[3];
  int i = 0;
  do {
    data[data[2]] = 21 * i;
    i = i + 1;
  } while (i < stop);
}
void strength_result10(int *data)
{
  int stop = data[3] * 21;
  int i = 0;
  do {
    data[data[2]] = i;
    i = i + 21;
  } while (i < stop);
}


-- 
           Summary: missed strength reduction optimization (test
                    replacement)
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dann at godzilla dot ics dot uci dot edu


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

Reply via email to