diff options
| author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-03-27 19:42:55 +0000 |
|---|---|---|
| committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2018-03-27 19:42:55 +0000 |
| commit | 17f3338015fff468212a5942aa85c77c9b07ddc0 (patch) | |
| tree | 9cd2a53e75667150c31d81744102dbdf0c46f2e7 /llvm/lib | |
| parent | 675767a5910d2ec77ef8b51c78fe312cf9022896 (diff) | |
| download | bcm5719-llvm-17f3338015fff468212a5942aa85c77c9b07ddc0.tar.gz bcm5719-llvm-17f3338015fff468212a5942aa85c77c9b07ddc0.zip | |
AMDGPU: Fix not preserving CSR VGPR if used for SGPR spills
Before this was not done if the function had no calls in it. This
is still a possible issue with any callable function, regardless
of calls present.
llvm-svn: 328659
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp index 2534ad02478..f78578ad9c8 100644 --- a/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp @@ -273,10 +273,9 @@ bool SIMachineFunctionInfo::allocateSGPRSpillToVGPR(MachineFunction &MF, } Optional<int> CSRSpillFI; - if (FrameInfo.hasCalls() && CSRegs && isCalleeSavedReg(CSRegs, LaneVGPR)) { - // TODO: Should this be a CreateSpillStackObject? This is technically a - // weird CSR spill. - CSRSpillFI = FrameInfo.CreateStackObject(4, 4, false); + if ((FrameInfo.hasCalls() || !isEntryFunction()) && CSRegs && + isCalleeSavedReg(CSRegs, LaneVGPR)) { + CSRSpillFI = FrameInfo.CreateSpillStackObject(4, 4); } SpillVGPRs.push_back(SGPRSpillVGPRCSR(LaneVGPR, CSRSpillFI)); |

