[PATCH] D17289: [X86] Fix False Data Dependency in popcnt
David Kreitzer via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 07:11:30 PDT 2016
DavidKreitzer added a comment.
Thanks for the comments, Steven! We are still working on fixing the popcnt false dependence problem, but we are planning to abandon this patch.
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
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.
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