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

--- Comment #2 from Marc Glisse <glisse at gcc dot gnu.org> ---
Another optimization prevented by __builtin_unreachable:

extern void f();
void g(int i){
  if(i>0){
    f();
    __builtin_unreachable();
  }
}

misses that f is a tail call and generates at -O3 on x86_64:

    testl    %edi, %edi
    jg    .L6
    rep ret
.L6:
    pushq    %rax
    xorl    %eax, %eax
    call    f

instead of (removing the builtin):

    testl    %edi, %edi
    jle    .L1
    xorl    %eax, %eax   ( in C++ this line disappears )
    jmp    f
.L1:
    rep ret

(it inverted the comparison, but my point is "call" vs "jmp")

Reply via email to