https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125970
--- Comment #2 from cuilili <lili.cui at intel dot com> --- Pinski's suspicion is correct — this is an alignment issue. The binary I posted was built with -march=znver5. When I rebuild with -march=x86-64-v3, the patched version happens to emit one extra mov, which shifts the hot bb, and the bounds disappear. For option: -O2 -mtune=generic -march=x86-64-v3 base: 0.43 │199: movslq (%rdi),%rax 0.41 │ pxor %xmm10,%xmm10 0.40 │ mov %ecx,%r14d 0.41 │ add $0x1,%ecx 0.39 │ mov %rax,%r10 0.39 │ lea (%rax,%rax,8),%rax 0.41 │ lea (%r8,%rax,8),%rax 0.79 │ movsd 0x10(%rax),%xmm9 0.46 │ mulsd %xmm8,%xmm9 0.83 │ movsd %xmm9,0x10(%rdx) 0.83 │ movsd 0x40(%rax),%xmm1 0.87 │ movsd %xmm9,0x10(%rax) 0.84 │ movsd %xmm1,0x40(%rdx) 0.87 │ movsd 0x38(%rax),%xmm3 0.86 │ addsd %xmm9,%xmm3 0.80 │ movsd %xmm3,0x40(%rax) 0.82 │ movapd %xmm3,%xmm2 0.56 │ movsd %xmm3,0x38(%rdx) 0.56 │ movupd 0x28(%rax),%xmm1 0.52 │ movups %xmm1,0x28(%rdx) 0.58 │ movsd (%rbx),%xmm1 0.57 │ addsd %xmm1,%xmm2 0.54 │ subsd %xmm3,%xmm1 0.59 │ mulsd 0x0(%rbp),%xmm1 0.59 │ movapd %xmm1,%xmm3 0.65 │ divsd %xmm2,%xmm3 1.28 │ cvttsd2si %xmm3,%r11d 1.30 │ cvtsi2sd %r11d,%xmm10 1.24 │ mulsd %xmm10,%xmm2 0.63 │ movsd %xmm10,0x30(%rax) 0.95 │ ucomisd %xmm1,%xmm2 0.48 │ ↓ jp 22e patch: 0.64 │ d0: movslq (%rdi),%rax 0.62 │ mov -0x10(%rsp),%r15 -----additional move 0.62 │ pxor %xmm10,%xmm10 0.60 │ mov %ecx,%r14d 0.58 │ add $0x1,%ecx 0.58 │ mov %rax,%r11 0.69 │ lea (%rax,%rax,8),%rax 0.54 │ lea (%r8,%rax,8),%rax 0.66 │ movsd 0x10(%rax),%xmm9 0.68 │ mulsd %xmm8,%xmm9 0.64 │ movsd %xmm9,0x10(%rdx) 1.03 │ movsd 0x40(%rax),%xmm1 0.70 │ movsd %xmm9,0x10(%rax) 0.59 │ movsd %xmm1,0x40(%rdx) 0.58 │ movsd 0x38(%rax),%xmm3 0.58 │ addsd %xmm9,%xmm3 0.50 │ movsd %xmm3,0x40(%rax) 0.43 │ movapd %xmm3,%xmm2 0.68 │ movsd %xmm3,0x38(%rdx) 0.47 │ movupd 0x28(%rax),%xmm1 0.48 │ movups %xmm1,0x28(%rdx) 0.47 │ movsd (%rbx),%xmm1 0.48 │ addsd %xmm1,%xmm2 0.46 │ subsd %xmm3,%xmm1 0.50 │ mulsd (%r15),%xmm1 0.77 │ movapd %xmm1,%xmm3 0.51 │ divsd %xmm2,%xmm3 0.81 │ cvttsd2si %xmm3,%r10d 0.94 │ cvtsi2sd %r10d,%xmm10 0.55 │ mulsd %xmm10,%xmm2 0.42 │ movsd %xmm10,0x30(%rax) 0.91 │ ucomisd %xmm1,%xmm2 0.44 │ ↓ jp 16a
