<div dir="ltr">OK, but the with the new patch, the generated assembly file is identical with the assembly generated by a clean compiler (without the patch).<div><br></div><div>Dehao</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 13, 2017 at 9:21 AM, Xin Tong <span dir="ltr"><<a href="mailto:trent.xin.tong@gmail.com" target="_blank">trent.xin.tong@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Fri, Jan 13, 2017 at 7:36 AM, Dehao Chen via Phabricator<br>
<<a href="mailto:reviews@reviews.llvm.org">reviews@reviews.llvm.org</a>> wrote:<br>
> danielcdh added a comment.<br>
><br>
> Looks like this patch will make the "always call" worse:<br>
><br>
> Without this patch:<br>
><br>
>   pushq   %rbx<br>
>   movq    %rdi, %rbx<br>
>   cmpl    $0, (%rbx)<br>
>   jne     .LBB1_3<br>
><br>
> .LBB1_1:                                # =>This Inner Loop Header: Depth=1<br>
><br>
>   movq    %rbx, %rdi<br>
>   callq   call_me<br>
>   cmpl    $0, (%rbx)<br>
>   je      .LBB1_1<br>
><br>
> .LBB1_3:<br>
><br>
>   popq    %rbx<br>
>   retq<br>
><br>
> With this patch:<br>
><br>
>   pushq   %rbx<br>
>   movq    %rdi, %rbx<br>
>   cmpl    $0, (%rbx)<br>
>   je      .LBB1_1<br>
><br>
> .LBB1_3:<br>
><br>
>   popq    %rbx<br>
>   retq<br>
><br>
> .LBB1_1:                                # =>This Inner Loop Header: Depth=1<br>
><br>
>   movq    %rbx, %rdi<br>
>   callq   call_me<br>
>   cmpl    $0, (%rbx)<br>
>   jne     .LBB1_3<br>
>   jmp     .LBB1_1<br>
><br>
> 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.<br>
><br>
><br>
> <a href="https://reviews.llvm.org/D28593" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D28593</a><br>
><br>
><br>
><br>
<br>
</div></div>Sorry there is a mistaken updating the branch weight for the guard<br>
block. I fixed it. what i said before still hold true.<br>
<span class="HOEnZb"><font color="#888888">-Xin<br>
</font></span></blockquote></div><br></div>