From: vnalamot Date: Thu, 20 Aug 2020 14:18:11 +0000 (+0530) Subject: allSGPRSpillsAreDead() should use actual FP/BP frame indices X-Git-Tag: llvmorg-13-init~14151 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=54d8ded4b19aeba05006367766d148d34be01c02;p=platform%2Fupstream%2Fllvm.git allSGPRSpillsAreDead() should use actual FP/BP frame indices The SGPR spills happen in SILowerSGPRSpills() and allSGPRSpillsAreDead() make sure there are no SGPR spills pending during PEI. But the FP/BP spills happen during PEI and are exceptions. Use actual frame indices of FP/BP in allSGPRSpillsAreDead() to accommodate the exceptions. Differential Revision: https://reviews.llvm.org/D86291 --- diff --git a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp index d73b290..9b795b2 100644 --- a/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp +++ b/llvm/lib/Target/AMDGPU/SIFrameLowering.cpp @@ -1076,15 +1076,15 @@ static bool allStackObjectsAreDead(const MachineFrameInfo &MFI) { } #ifndef NDEBUG -static bool allSGPRSpillsAreDead(const MachineFrameInfo &MFI, - Optional FramePointerSaveIndex, - Optional BasePointerSaveIndex) { +static bool allSGPRSpillsAreDead(const MachineFunction &MF) { + const MachineFrameInfo &MFI = MF.getFrameInfo(); + const SIMachineFunctionInfo *FuncInfo = MF.getInfo(); for (int I = MFI.getObjectIndexBegin(), E = MFI.getObjectIndexEnd(); I != E; ++I) { if (!MFI.isDeadObjectIndex(I) && MFI.getStackID(I) == TargetStackID::SGPRSpill && - ((FramePointerSaveIndex && I != FramePointerSaveIndex) || - (BasePointerSaveIndex && I != BasePointerSaveIndex))) { + (I != FuncInfo->FramePointerSaveIndex && + I != FuncInfo->BasePointerSaveIndex)) { return false; } } @@ -1111,7 +1111,7 @@ void SIFrameLowering::processFunctionBeforeFrameFinalized( SIMachineFunctionInfo *FuncInfo = MF.getInfo(); FuncInfo->removeDeadFrameIndices(MFI); - assert(allSGPRSpillsAreDead(MFI, None, None) && + assert(allSGPRSpillsAreDead(MF) && "SGPR spill should have been removed in SILowerSGPRSpills"); // FIXME: The other checks should be redundant with allStackObjectsAreDead,