------- Comment #13 from rguenth at gcc dot gnu dot org  2009-03-20 22:44 
-------
It at least still happens with 4.3 and I have no belief that it is fixed with
4.4 if comment #3 applies.  Code generated is also absymal (-O2):

_ZN1t18__U3c_clinit__U3e_EJvv:
.LFB2:
        pushl   %ebp
.LCFI0:
        movl    %esp, %ebp
.LCFI1:
        subl    $8, %esp
.LCFI2:
        movl    $4, 4(%esp)
        movl    $_Jv_intClass, (%esp)
        call    _Jv_NewPrimArray
        movl    4(%eax), %edx
        testl   %edx, %edx
        je      .L8
        cmpl    $1, %edx
        movl    $5, 8(%eax)
        jbe     .L9
        cmpl    $2, %edx
        movl    $7, 12(%eax)
        jbe     .L10
        cmpl    $3, %edx
        movl    $9, 16(%eax)
        jbe     .L11
        movl    $11, 20(%eax)
        movl    %eax, _ZN1t1xE
        leave
        ret
.L8:
        movl    $0, (%esp)
        call    _Jv_ThrowBadArrayIndex
.L9:
        movl    $1, (%esp)
        call    _Jv_ThrowBadArrayIndex
.L10:
        movl    $2, (%esp)
        call    _Jv_ThrowBadArrayIndex
.L11:
        movl    $3, (%esp)
        call    _Jv_ThrowBadArrayIndex

(4.3 again), we do not seem to be able to CSE the load of the array length
on the tree level and we have no way (still) of commoning the calls to
_Jv_ThrowBadArrayIndex either:

<bb 2>:
  D.241 = _Jv_NewPrimArray (&_Jv_intClass, 4);
  D.249 = D.241->length;
  if (D.249 != 0)
    goto <bb 4>;
  else
    goto <bb 3>;

<bb 3>:
  _Jv_ThrowBadArrayIndex (0);

<bb 4>:
  D.241->data[0] = 5;
  D.263 = D.241->length;
  if ((unsigned int) D.263 > 1)
    goto <bb 6>;
  else
    goto <bb 5>;

<bb 5>:
  _Jv_ThrowBadArrayIndex (1);

<bb 6>:
  D.241->data[1] = 7;
  D.277 = D.241->length;
  if ((unsigned int) D.277 > 2)
    goto <bb 8>;
  else
    goto <bb 7>;

<bb 7>:
  _Jv_ThrowBadArrayIndex (2);

<bb 8>:
  D.241->data[2] = 9;
  D.291 = D.241->length;
  if ((unsigned int) D.291 > 3)
    goto <bb 10>;
  else
    goto <bb 9>;

<bb 9>:
  _Jv_ThrowBadArrayIndex (3);

<bb 10>:
  D.241->data[3] = 11;
  x = D.241;
  return;


-- 


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

Reply via email to