https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37262

--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
I confirm that there are no duplicated branch instructions in object code
emitted by GCC 6.0, although the branches that are there don't look quite
optimal.

I built the gcc-5-branch on powerpc64-linux and the duplicate instructions are
still there with the second test case compiled at -O2 (see below).

$ /build/gcc-5.x/gcc/xgcc -B /build/gcc-5.x/gcc -O1 -S -Wall -Wextra -Wpedantic
-o/dev/stdout -m32 t.c
        .file   "t.c"
        .machine power4
t.c: In function ‘_bfd_xcoff_canonicalize_dynamic_reloc’:
t.c:15:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
        .section        ".text"
        .align 2
        .globl _bfd_xcoff_canonicalize_dynamic_reloc
        .type   _bfd_xcoff_canonicalize_dynamic_reloc, @function
_bfd_xcoff_canonicalize_dynamic_reloc:
        cmpwi 0,3,0
        bne 0,.L2          <<< branch
        bne 0,.L6          <<< duplicate branch
        cmplwi 7,4,2
        bgt 7,.L2
.L6:
        cmpwi 7,3,0
        bne 7,.L2
        cmplwi 7,4,2
        bne 7,.L2
        stwu 1,-16(1)
        mflr 0
        stw 0,20(1)
        bl _bfd_abort
        b .L1
.L2:
        blr
.L1:
        lwz 0,20(1)
        mtlr 0
        addi 1,1,16
        blr
        .size  
_bfd_xcoff_canonicalize_dynamic_reloc,.-_bfd_xcoff_canonicalize_dynamic_reloc
        .ident  "GCC: (GNU) 5.3.1 20160130"
        .section        .note.GNU-stack,"",@progbits

Reply via email to