From: Matt Arsenault Date: Mon, 24 Jun 2019 14:34:40 +0000 (+0000) Subject: AMDGPU: Cleanup checking when spills need emergency slots X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3080eb62d6dc4b50872af0343079a55354df21bb;p=llvm AMDGPU: Cleanup checking when spills need emergency slots Address fixme, which should no longer be a problem since r363757. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@364182 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/AMDGPU/SIFrameLowering.cpp b/lib/Target/AMDGPU/SIFrameLowering.cpp index 11d41775421..c2880244b66 100644 --- a/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/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()) {