[AMDGPU] Propagate defining src reg for AGPR to AGPR Copys
authorVang Thao <Vang.Thao@amd.com>
Fri, 27 Aug 2021 16:56:12 +0000 (09:56 -0700)
committerVang Thao <Vang.Thao@amd.com>
Thu, 23 Sep 2021 22:17:53 +0000 (15:17 -0700)
commit1443ba6163d66743ff9f9d28b0505fca159b824c
tree2e8ba378c34fa1bbf6e6bffc1df9dca1a6035d9f
parent80b92db02c5aec4e92b2df1492e8268a3239de26
[AMDGPU] Propagate defining src reg for AGPR to AGPR Copys

On targets that do not support AGPR to AGPR copying directly, try to find the
defining accvgpr_write and propagate its source vgpr register to the copies
before register allocation so the source vgpr register does not get clobbered.

The postrapseudos pass also attempt to propagate the defining accvgpr_write but
if the register to propagate is clobbered, it will give up and create new
temporary vgpr registers instead.

Reviewed By: rampitec

Differential Revision: https://reviews.llvm.org/D108830
llvm/lib/Target/AMDGPU/GCNPreRAOptimizations.cpp
llvm/test/CodeGen/AMDGPU/agpr-to-agpr-copy.mir [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/llvm.amdgcn.mfma.ll