[Bug tree-optimization/35357] Loop peeling not happening

xinliangli at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Oct 26 16:56:00 GMT 2012


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

--- Comment #2 from davidxl <xinliangli at gmail dot com> 2012-10-26 16:55:48 UTC ---
(In reply to comment #1)
> What is the expected optimization and what is its benefit?

Should be transformed into the following the simplified loop body.
void foo(int n)
{
      int i;

      if (n > 0) {
       for ( i = 0; i < n; i++)
        {
           b[i*2] = a[3*i+1];
           b[i*2] +=1; 
        }
        b[i*2] = a[3*i + 1];
      }
}

Icc at O2 distributes the loop body:

     for ( i = 0; i <= n; i++)
      {
           b[i*2] = a[3*i+1]; 
      }
    for ( i = 0; i < n; i++)
      {
           b[i*2] += 1; 
      }



More information about the Gcc-bugs mailing list