On Tue, Jun 21, 2022 at 5:06 AM xionghuluo(罗雄虎) via Gcc-patches <gcc-patches@gcc.gnu.org> wrote: > > Current GCC generates: > > > test2: > .LFB0: > .cfi_startproc > xorl %edx, %edx > cmpl $3, (%rdi) > jle .L1 > movl 16(%rdi), %eax > cmpl $1, %eax > je .L4 > subl $2, %eax > cmpl $4, %eax > ja .L1 > movl CSWTCH.1(,%rax,4), %edx > .L1: > movl %edx, %eax > ret > .p2align 4,,10 > .p2align 3 > .L4: > movl $12, %edx > jmp .L1 > .cfi_endproc > .LFE0: > .size test2, .-test2 > .section .rodata > .align 16 > .type CSWTCH.1, @object > .size CSWTCH.1, 20 > CSWTCH.1: > .long 27 > .long 38 > .long 18 > .long 58 > .long 68 > > > > > With the patch attatched: > > > test2: > .LFB0: > .cfi_startproc > xorl %edx, %edx > cmpl $3, (%rdi) > jle .L1 > movl 16(%rdi), %eax > subl $1, %eax > cmpl $5, %eax > jbe .L6 > .L1: > movl %edx, %eax > ret > .p2align 4,,10 > .p2align 3 > .L6: > movl CSWTCH.1(,%rax,4), %edx > movl %edx, %eax > ret > .cfi_endproc > .LFE0: > .size test2, .-test2 > .section .rodata > .align 16 > .type CSWTCH.1, @object > .size CSWTCH.1, 24 > CSWTCH.1: > .long 12 > .long 27 > .long 38 > .long 18 > .long 58 > .long 68 > > > Bootstrap and regression tested pass on x86_64-linux-gnu, OK for master?
OK if you add a comment that an empty conditions_in_bbs indicates we are processing the first basic-block (that's not obvious to me). Thanks, Richard.