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



Richard Biener <rguenth at gcc dot gnu.org> changed:



           What    |Removed                     |Added

----------------------------------------------------------------------------

           Keywords|                            |missed-optimization

             Status|UNCONFIRMED                 |RESOLVED

         Resolution|                            |FIXED

   Target Milestone|---                         |4.8.0

            Summary|Optimizer can't invert      |At -Os basic blocks are not

                   |conditional when inlining a |properly re-ordered to

                   |bool function               |avoid fallthru jumps



--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> 2013-03-12 
09:34:23 UTC ---

The blocks simply happen to be ordered differently on the GIMPLE level,

for some reason with -Os that ordering persists and with -O[23] the ordering

is reverted to make the appearantly more likely path the fallthru one.



The bug is that for -Os the fallthru paths are not avoided.



This works on trunk though, so - fixed.



_Z5func1j:

.LFB1:

        .cfi_startproc

        pushq   %rbx

        .cfi_def_cfa_offset 16

        .cfi_offset 3, -16

        movl    %edi, %ebx

        movl    $.LC0, %edi

        call    puts

        cmpl    $9, %ebx

        jbe     .L2

        movl    %ebx, %eax

        andl    $7, %eax

        decl    %eax

        jne     .L2

        movl    $.LC2, %edi

        call    puts

.L2:

        movl    $.LC1, %edi

        call    puts

        leal    1(%rbx), %eax

        popq    %rbx

       .cfi_def_cfa_offset 8

        ret



_Z5func2j:

.LFB2:

        .cfi_startproc

        pushq   %rbx

        .cfi_def_cfa_offset 16

        .cfi_offset 3, -16

        movl    %edi, %ebx

        movl    $.LC0, %edi

        call    puts

        cmpl    $9, %ebx

        jbe     .L8

        movl    %ebx, %eax

        andl    $7, %eax

        decl    %eax

        jne     .L8

        movl    $.LC2, %edi

        call    puts

.L8:

        movl    $.LC1, %edi

        call    puts

        leal    1(%rbx), %eax

        popq    %rbx

        .cfi_def_cfa_offset 8

        ret

Reply via email to