[Bug rtl-optimization/46265] Missing ifcvt

davidxl at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Nov 3 05:59:00 GMT 2010


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

--- Comment #3 from davidxl <davidxl at gcc dot gnu.org> 2010-11-03 05:59:30 UTC ---
Another example gcc fails to ifcvt (succeeds only if only one statement is in
if and else block.

void ref_int_p(int *); 

void foo (int j, int k)
{
  int i;
  int a[200], b[100];
  i = 0;
  for ( ; i < 100; i++)
  {
    if (j < k)
      {   
        a[i] = j;
        b[i] = j;
      }   
      else
      {   
        a[i] = 1;
        b[i] = 1;
      }   
 }
  ref_int_p (&a[0]);
  ref_int_p (&b[0]);

  return;
}

It (the loop) should be generated like:

LBB0_1:
        cmpl    %esi, %edi
        movl    $1, %ecx
        cmovll  %edi, %ecx
        movl    %ecx, -800(%rbp,%rax,4)
        movl    %ecx, -1200(%rbp,%rax,4)
        incq    %rax
        cmpq    $100, %rax
        jne     .LBB0_1

David



More information about the Gcc-bugs mailing list