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 rtl-optimization/56598] At -Os basic blocks are not properly re-ordered to avoid fallthru jumps


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


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