diff options
-rw-r--r-- | llvm/lib/Target/AMDGPU/SIFrameLowering.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp index 11d41775421..c2880244b66 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp @@ -721,10 +721,13 @@ void SIFrameLowering::emitEpilogue(MachineFunction &MF, } } -static bool allStackObjectsAreDead(const MachineFrameInfo &MFI) { +// Note SGPRSpill stack IDs should only be used for SGPR spilling to VGPRs, not +// memory. +static bool allStackObjectsAreDeadOrSGPR(const MachineFrameInfo &MFI) { for (int I = MFI.getObjectIndexBegin(), E = MFI.getObjectIndexEnd(); I != E; ++I) { - if (!MFI.isDeadObjectIndex(I)) + if (!MFI.isDeadObjectIndex(I) && + MFI.getStackID(I) != TargetStackID::SGPRSpill) return false; } @@ -786,11 +789,7 @@ void SIFrameLowering::processFunctionBeforeFrameFinalized( FuncInfo->removeSGPRToVGPRFrameIndices(MFI); - // FIXME: The other checks should be redundant with allStackObjectsAreDead, - // but currently hasNonSpillStackObjects is set only from source - // allocas. Stack temps produced from legalization are not counted currently. - if (FuncInfo->hasNonSpillStackObjects() || FuncInfo->hasSpilledVGPRs() || - !AllSGPRSpilledToVGPRs || !allStackObjectsAreDead(MFI)) { + if (!allStackObjectsAreDeadOrSGPR(MFI)) { assert(RS && "RegScavenger required if spilling"); if (FuncInfo->isEntryFunction()) { |