Skip to content

Commit 54d8ded

Browse files
RamNalamothuarsenm
authored andcommitted
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
1 parent b74b80b commit 54d8ded

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

llvm/lib/Target/AMDGPU/SIFrameLowering.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,15 +1076,15 @@ static bool allStackObjectsAreDead(const MachineFrameInfo &MFI) {
10761076
}
10771077

10781078
#ifndef NDEBUG
1079-
static bool allSGPRSpillsAreDead(const MachineFrameInfo &MFI,
1080-
Optional<int> FramePointerSaveIndex,
1081-
Optional<int> BasePointerSaveIndex) {
1079+
static bool allSGPRSpillsAreDead(const MachineFunction &MF) {
1080+
const MachineFrameInfo &MFI = MF.getFrameInfo();
1081+
const SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
10821082
for (int I = MFI.getObjectIndexBegin(), E = MFI.getObjectIndexEnd();
10831083
I != E; ++I) {
10841084
if (!MFI.isDeadObjectIndex(I) &&
10851085
MFI.getStackID(I) == TargetStackID::SGPRSpill &&
1086-
((FramePointerSaveIndex && I != FramePointerSaveIndex) ||
1087-
(BasePointerSaveIndex && I != BasePointerSaveIndex))) {
1086+
(I != FuncInfo->FramePointerSaveIndex &&
1087+
I != FuncInfo->BasePointerSaveIndex)) {
10881088
return false;
10891089
}
10901090
}
@@ -1111,7 +1111,7 @@ void SIFrameLowering::processFunctionBeforeFrameFinalized(
11111111
SIMachineFunctionInfo *FuncInfo = MF.getInfo<SIMachineFunctionInfo>();
11121112

11131113
FuncInfo->removeDeadFrameIndices(MFI);
1114-
assert(allSGPRSpillsAreDead(MFI, None, None) &&
1114+
assert(allSGPRSpillsAreDead(MF) &&
11151115
"SGPR spill should have been removed in SILowerSGPRSpills");
11161116

11171117
// FIXME: The other checks should be redundant with allStackObjectsAreDead,

0 commit comments

Comments
 (0)