[PATCH] D17289: [X86] Fix False Data Dependency in popcnt

Steven Noonan via llvm-commits llvm-commits at lists.llvm.org
Mon May 9 11:34:49 PDT 2016


tycho added a comment.

In http://reviews.llvm.org/D17289#424618, @DavidKreitzer wrote:

> Our plan is to first fix the register allocator to bias register assignment choices to hide false dependences. If there is a true dependence on the destination register, then there is no additional cost for the false dependence. So, for example, we will strive to generate
>
>   popcnt %rax, %rax
>   popcnt (%rcx), %rcx
>
>
> rather than
>
>   xor %rdx, %rdx
>   popcnt %rax, %rdx
>   xor %rbx, %rbx
>   popcnt (%rcx), %rbx
>


My simple tests locally show that does resolve the issue. Nice idea.

Can you CC me on the review for that when it happens?

> The second step will be to enhance the ExecutionDependencyFix pass to support popcnt, which will require us to add support for integer instructions in general. You are right that unconditionally adding an xor (excluding the cases where it is not legal to do so) is better than doing nothing. But since we already have a pass that is designed exactly for the purpose of deciding when it is or isn't profitable to add the xor, we ought to use it.


I agree, that sounds sensible.

> Note that the RA enhancements will also improve many of the instructions that are currently supported by the ExecutionDependencyFix pass, e.g.

> 

>   cvtss2sd %xmm1, %xmm0

>   sqrtss %xmm2, %xmm3

> 



Repository:
  rL LLVM

http://reviews.llvm.org/D17289





More information about the llvm-commits mailing list