This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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; 
      }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]