[PATCH] D28593: Update loop branch_weight metadata after loop rotation.
Dehao Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 13 07:36:08 PST 2017
danielcdh added a comment.
Looks like this patch will make the "always call" worse:
Without this patch:
pushq %rbx
movq %rdi, %rbx
cmpl $0, (%rbx)
jne .LBB1_3
.LBB1_1: # =>This Inner Loop Header: Depth=1
movq %rbx, %rdi
callq call_me
cmpl $0, (%rbx)
je .LBB1_1
.LBB1_3:
popq %rbx
retq
With this patch:
pushq %rbx
movq %rdi, %rbx
cmpl $0, (%rbx)
je .LBB1_1
.LBB1_3:
popq %rbx
retq
.LBB1_1: # =>This Inner Loop Header: Depth=1
movq %rbx, %rdi
callq call_me
cmpl $0, (%rbx)
jne .LBB1_3
jmp .LBB1_1
As the trip count of this loop is always 1, the first code will have no taken branches, while with this patch, it will have 2 taken branches.
https://reviews.llvm.org/D28593
More information about the llvm-commits
mailing list