https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92455
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- You need partial-PRE to perform the desired transform. With -O3 or -O2 -ftree-partial-pre we do what you suggest (plus also cache *max->ptr in exchange for another IV): f1: .LFB0: .cfi_startproc movq (%rdi), %rax leaq 40(%rdi), %rcx movq %rdi, %rsi movl (%rax), %edx .L3: movq 8(%rdi), %rax addq $8, %rdi movl (%rax), %eax cmpl %edx, %eax jle .L2 movl %eax, %edx movq %rdi, %rsi .L2: cmpq %rdi, %rcx jne .L3 movq (%rsi), %rax ret because of the two conditional values (*max and *max->ptr_) the cmov transform doesn't trigger.