http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60747
--- Comment #2 from tech <techsgin at gmail dot com> --- Created attachment 32533 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32533&action=edit Assembly of O2 no tree-vrp Assembly of O2 no tree-vrp .file "main.cpp" .text .p2align 4,,15 .globl _Z7hash_itPKci .type _Z7hash_itPKci, @function _Z7hash_itPKci: .LFB26: .cfi_startproc .cfi_personality 0x3,__gxx_personality_v0 pushq %rbp .cfi_def_cfa_offset 16 .cfi_offset 6, -16 movl %esi, %ebp pushq %rbx .cfi_def_cfa_offset 24 .cfi_offset 3, -24 movq %rdi, %rbx subq $8, %rsp .cfi_def_cfa_offset 32 call strlen testl %eax, %eax movl %eax, %edx jle .L3 leaq 1(%rbx), %rcx leal -1(%rax), %esi leaq (%rcx,%rsi), %rsi jmp .L4 .p2align 4,,10 .p2align 3 .L11: addq $1, %rcx .L4: movsbl (%rbx), %ebx imull $777, %edx, %edx addl %ebx, %edx cmpq %rsi, %rcx movq %rcx, %rbx jne .L11 .L3: testl %edx, %edx jns .L9 negl %edx .L9: movl %edx, %eax sarl $31, %edx addq $8, %rsp .cfi_def_cfa_offset 24 idivl %ebp popq %rbx .cfi_def_cfa_offset 16 popq %rbp .cfi_def_cfa_offset 8 movl %edx, %eax ret