Open shiltian opened 2 weeks ago
@llvm/issue-subscribers-backend-amdgpu
Author: Shilei Tian (shiltian)
It seems we can’t simply perform another SGPR-to-VGPR spill here, as we’re effectively already doing it. It appears we’ll need to reserve two SGPRs specifically for this purpose and disable them using an attribute.
In
emitCSRSpillStores
, a non-callee-saved SGPR is required to saveexec
, which limits us to using SGPR0 through SGPR29. Currently, we assume that one is always available; however, this isn’t always the case, as SGPR0 to SGPR29 are also used forinreg
argument passing.https://github.com/llvm/llvm-project/blob/3b7d788ff22b8aa22634b927faf01da12bece496/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp#L966
If there are enough
inreg
arguments, no SGPR is available, leading to a compiler crash. The following example demonstrates this issue.