[PATCH] D28593: Update loop branch_weight metadata after loop rotation.

Dehao Chen via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 13 09:34:54 PST 2017


OK, but the with the new patch, the generated assembly file is identical
with the assembly generated by a clean compiler (without the patch).

Dehao

On Fri, Jan 13, 2017 at 9:21 AM, Xin Tong <trent.xin.tong at gmail.com> wrote:

> On Fri, Jan 13, 2017 at 7:36 AM, Dehao Chen via Phabricator
> <reviews at reviews.llvm.org> wrote:
> > 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
> >
> >
> >
>
> Sorry there is a mistaken updating the branch weight for the guard
> block. I fixed it. what i said before still hold true.
> -Xin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170113/e9d99ffc/attachment.html>


More information about the llvm-commits mailing list