[all-commits] [llvm/llvm-project] 319730: AMDGPU: Fix clobbering SCC when expanding large of...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Mon Feb 7 07:02:15 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 31973062ec2290004f67eeb0aa6f468d1f2f1a86
      https://github.com/llvm/llvm-project/commit/31973062ec2290004f67eeb0aa6f468d1f2f1a86
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2022-02-07 (Mon, 07 Feb 2022)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
    A llvm/test/CodeGen/AMDGPU/accvgpr-spill-scc-clobber.mir
    A llvm/test/CodeGen/AMDGPU/sgpr-spill-to-vmem-scc-clobber-unhandled.mir
    A llvm/test/CodeGen/AMDGPU/sgpr-spill-to-vmem-scc-clobber.mir
    M llvm/test/CodeGen/AMDGPU/spill-offset-calculation.ll
    M llvm/test/CodeGen/AMDGPU/spill-scavenge-offset.ll
    A llvm/test/CodeGen/AMDGPU/vgpr-spill-scc-clobber.mir

  Log Message:
  -----------
  AMDGPU: Fix clobbering SCC when expanding large offset spill pseudos

If we had a large offset which required materializing in a register,
we would emit an s_add_i32, clobbering SCC. Start checking if SCC is
live, and instead use a VGPR offset. For MUBUF, we switch to using
offen. We would do this anyway in a normal load/store with a frame
index, but not for spills.

The same problem still exists in other contexts where we expand frame
indices.

The nasty edge case is when SGPRs are spilled to memory at a large
frame offset where SCC is also clobbered. This requires a second
scavenging index, and also required several patches in the scavenger
to correctly handle multiple recursive scavenge indexes.

An even nastier edge case we still don't support is if we don't have
any free SGPRs. If SCC is live and we don't have any free SGPRs to
save exec, we have no way of flipping exec back and forth without also
clobbering SCC.

Fixes: SWDEV-309419




More information about the All-commits mailing list