[Bug tree-optimization/32698] New: [4.3 regression] inefficient pointer expression

zippel at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Mon Jul 9 13:25:00 GMT 2007


Taking this example:

int foo(int *p, unsigned int i)
{       
  return p[i + 1] + p[i + 2] + p[i + 3];
}

produces inefficient code. The problem already starts at tree level, where for
"p[i+1]" an expression like *(p + (i + 1) * 4)) is generated, which is not a
common pointer expression.
Also since this is different from the other generated pointer expression, the
common index expression isn't completely replaced.

An initial discussion about this can be found here:
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg00418.html


-- 
           Summary: [4.3 regression] inefficient pointer expression
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zippel at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu


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



More information about the Gcc-bugs mailing list