[Bug tree-optimization/53804] branch reordering missed optimization

steven at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jun 29 10:43:00 GMT 2012


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

--- Comment #1 from Steven Bosscher <steven at gcc dot gnu.org> 2012-06-29 10:43:19 UTC ---
On x86_64-unknown-linux-gnu, this case is optimized because the second branch
condition is combined for both foo1 and foo2:

<bb 3>:
  D.1723_4 = b_3(D) > 0;
  D.1724_5 = a_2(D) < 0;
  D.1725_6 = D.1724_5 & D.1723_4;
  if (D.1725_6 != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

=>

foo1:
        testl   %edi, %edi
        movl    $1, %eax
        jle     .L9
        rep
        ret
.L9:
        shrl    $31, %edi
        testb   %dil, %dil
        jne     .L10
.L4:
        movl    $9, %eax
        ret
.L10:
        testl   %esi, %esi
        jle     .L4
        movl    $-3, %eax
        ret


foo2:
        testl   %edi, %edi
        movl    $1, %eax
        jle     .L18
        rep
        ret
.L18:
        shrl    $31, %edi
        testb   %dil, %dil
        jne     .L19
.L14:
        movl    $9, %eax
        ret
.L19:
        testl   %esi, %esi
        jle     .L14
        movl    $-3, %eax
        ret



More information about the Gcc-bugs mailing list