[Bug rtl-optimization/71923] return instruction emitted twice with branch target inbetween

2023-07-18 Thread javier.martinez.bugzilla at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71923

Javier Martinez  changed:

   What|Removed |Added

 CC||javier.martinez.bugzilla@gm
   ||ail.com

--- Comment #2 from Javier Martinez  
---
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

[Bug rtl-optimization/71923] return instruction emitted twice with branch target inbetween

2016-07-19 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71923

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-07-19
 Ever confirmed|0   |1

--- Comment #1 from Richard Biener  ---
Confirmed.  Trunk aligns stuff:

fact:
.LFB0:
.cfi_startproc
testl   %edi, %edi
movl$1, %eax
je  .L4
.p2align 4,,10
.p2align 3
.L3:
imull   %edi, %eax
subl$1, %edi
jne .L3
rep ret
.p2align 4,,10
.p2align 3
.L4:
rep ret
.cfi_endproc

this all is probably a BB reorder / cfg cleanup issue.