[AMDGPU] Add optional tied-op for wwm-register's epilog spill restore
authorChristudasan Devadasan <Christudasan.Devadasan@amd.com>
Thu, 11 May 2023 16:13:18 +0000 (21:43 +0530)
committerChristudasan Devadasan <Christudasan.Devadasan@amd.com>
Tue, 16 May 2023 05:36:06 +0000 (11:06 +0530)
commit08140d165e3d5b2257b26099469f7ae10c284dc7
tree601238d7ed54e141c3f449fe7adf37fb86e967eb
parent9adf60fc53fb105e331eec20e7fd2be71ee2a13c
[AMDGPU] Add optional tied-op for wwm-register's epilog spill restore

The COPY inserted in the epilog block before return instruction as part
of ABI lowering, can get optimized during machine copy propagation if
the same register is used earlier in a wwm operation that demands the
prolog/epilog wwm-spill store/restore to preserve its inactive lanes.
With the spill restore in the epilog, the preceding COPY appears to be
dead during machine-cp. To avoid it, mark the same register as a tied-op
in the spill restore instruction to ensure a usage for the COPY.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D150381
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
llvm/test/CodeGen/AMDGPU/preserve-only-inactive-lane.mir
llvm/test/CodeGen/AMDGPU/tied-op-for-wwm-scratch-reg-spill-restore.mir [new file with mode: 0644]