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

Javier Martinez <javier.martinez.bugzilla at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |javier.martinez.bugzilla@gm
                   |                            |ail.com

--- Comment #2 from Javier Martinez <javier.martinez.bugzilla at gmail dot com> 
---
Also reproducible with:

extern void s1(void);
extern void s2(void);

void foo(int i) {
    switch (i) {
        case 1:  return s1(); 
        case 2:  return s1();
        case 3:  return s2();
    }
}


On Trunk and with -O2 or higher:

foo(int):
  cmp edi, 2
  jg .L2
  test edi, edi
  jle .L7
  jmp s1             #tailcall
.LVL1:
  .p2align 4,,10
  .p2align 3
.L2:
  cmp edi, 3
  jne .L8
  jmp s2             #tailcall
.LVL2:
  .p2align 4,,10
  .p2align 3
.L7:
  ret                # <--- ret
  .p2align 4,,10
  .p2align 3
.L8:
  ret                # <--- ret

Reply via email to