[PATCH] D139852: [amdgpu] Lower CopyToReg into SGPR explicitly to avoid illegal vgpr to sgpr copy

Alexander via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 12 11:26:45 PST 2022


alex-t added a comment.

In D139852#3989299 <https://reviews.llvm.org/D139852#3989299>, @JonChesterfield wrote:

> In D139852#3989251 <https://reviews.llvm.org/D139852#3989251>, @alex-t wrote:
>
>> Since we ensure all the VGPR to SGPR copies are uniform, we just need to V_READFIRSTLANE_B32 here.
>
> What ensures this copy is uniform?

The divergence-driven ISel does.
The call argument would be VGPR if it is divergent.

> Even if it is uniform, is there a reason to expect readfirstlane to be better than a mov immediate?

Nevertheless, I would agree with you, that we only need to allow VGPR to physical SGPR copy if the VGPR is defined by the constant copy.
For now, it is the easiest way to fix the issue which blocks you. The common case (if it is okay to "readfirstlane" the general VGPR to physical SGPR ) needs further discussion.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139852/new/

https://reviews.llvm.org/D139852



More information about the llvm-commits mailing list