[AMDGPU] Make SGPR spills exec mask agnostic
authorCarl Ritson <carl.ritson@amd.com>
Wed, 3 Jun 2020 03:34:17 +0000 (12:34 +0900)
committerCarl Ritson <carl.ritson@amd.com>
Wed, 3 Jun 2020 03:34:26 +0000 (12:34 +0900)
commitda33c96d4762e0e59f1eff16f60d5c1575490331
tree09c283f5ee16143eb2bdf695daa482642beeefb0
parenta09bb6d77b39d3f87c76b525b355e158245a63cd
[AMDGPU] Make SGPR spills exec mask agnostic

Explicitly set the exec mask for SGPR spills and reloads.
This fixes a bug where SGPR spills to memory could be incorrect
if the exec mask was 0 (or differed between spill and reload).

Additionally pack scalar subregisters (upto 16/32 per VGPR),
so that the majority of scalar types can be spilt or reloaded
with a simple memory access.  This should amortize some of the
additional overhead of manipulating the exec mask.

Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D80282
llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
llvm/lib/Target/AMDGPU/SIRegisterInfo.h
llvm/test/CodeGen/AMDGPU/control-flow-fastregalloc.ll
llvm/test/CodeGen/AMDGPU/partial-sgpr-to-vgpr-spills.ll
llvm/test/CodeGen/AMDGPU/sgpr-spill.mir [new file with mode: 0644]
llvm/test/CodeGen/AMDGPU/si-spill-sgpr-stack.ll
llvm/test/CodeGen/AMDGPU/spill-m0.ll
llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll
llvm/test/CodeGen/AMDGPU/spill-wide-sgpr.ll