https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127693
--- Comment #23 from Thiago Macieira <thiago at kde dot org> ---
For completeness, -O3 generated assembly:
_ZN7Scanner12scanForSignsEv:
.LFB7687:
.cfi_startproc
subq $88, %rsp
.cfi_def_cfa_offset 96
movq %r12, 72(%rsp)
.cfi_offset 12, -24
movq (%rdi), %r12
movq %r13, 80(%rsp)
.cfi_offset 13, -16
movq 8(%rdi), %r13
movq %rbx, 56(%rsp)
movq $1, (%rsp)
movq $.LC0, 8(%rsp)
movq $1, 16(%rsp)
movq $.LC0, 24(%rsp)
movq %r12, 32(%rsp)
movq %r13, 40(%rsp)
testq %r12, %r12
.cfi_offset 3, -40
je .L4
movq %rbp, 64(%rsp)
.cfi_offset 6, -32
xorl %eax, %eax
leaq 0(%r13,%r12,2), %rbp
xorl %ebx, %ebx
.p2align 4
.p2align 3
.L3:
movq %r12, %rdx
subq %rax, %rdx
leaq 0(%r13,%rax,2), %rax
addq %rdx, %rdx
sarq $1, %rdx
xchgq %rdx, %rax
movq %rdx, %rsi
movq %rax, %rdi
movl $8722, %edx
call _ZN9QtPrivate8qustrchrE11QStringViewDs
cmpq %rax, %rbp
je .L7
subq %r13, %rax
movq %r12, 32(%rsp)
addl $1, %ebx
sarq $1, %rax
movq %r13, 40(%rsp)
movq $1, 16(%rsp)
addq $1, %rax
movq $.LC0, 24(%rsp)
cmpq %r12, %rax
jb .L3
.L7:
movq 64(%rsp), %rbp
.cfi_restore 6
jmp .L1
.L4:
xorl %ebx, %ebx
.L1:
movl %ebx, %eax
movq 72(%rsp), %r12
movq 56(%rsp), %rbx
movq 80(%rsp), %r13
addq $88, %rsp
.cfi_def_cfa_offset 8
ret
.cfi_endproc
(previously it was just ud2, inlined into callers)