https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83321
--- Comment #11 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- Hmm, for example this is the assembly diff of update_costs_from_copies() @@ -8450,7 +8446,6 @@ movl 12(%rdi), %eax sall $10, %eax sarl $16, %eax - testl %eax, %eax js .L1539 cmpw $0, 10(%rdi) je .L1539 So it looks like valgrind doesn't know that SAR also sets the Zero flag.