Skip to content

Commit da1aff2

Browse files
[llvm][PowerPC] Correct handling of spill slots for SPE when EXPENSIVE_CHECKS is enabled (#73940)
This was modifying a container as it iterated it, which tripped a check in libstdc++'s debug checks. Instead, just assign to the item via the reference we already have. This fixes the following expensive checks failures on my machine: LLVM :: CodeGen/PowerPC/fp-strict.ll LLVM :: CodeGen/PowerPC/pr55463.ll LLVM :: CodeGen/PowerPC/register-pressure.ll LLVM :: CodeGen/PowerPC/spe.ll Which are some of the tests noted by #68594.
1 parent f7d91fa commit da1aff2

File tree

1 file changed

+8
-16
lines changed

1 file changed

+8
-16
lines changed

llvm/lib/Target/PowerPC/PPCFrameLowering.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,24 +2334,16 @@ bool PPCFrameLowering::assignCalleeSavedSpillSlots(
23342334
// In case of SPE we only have SuperRegs and CRs
23352335
// in our CalleSaveInfo vector.
23362336

2337-
unsigned Idx = 0;
23382337
for (auto &CalleeSaveReg : CSI) {
2339-
const MCPhysReg &Reg = CalleeSaveReg.getReg();
2340-
const MCPhysReg &Lower = RegInfo->getSubReg(Reg, 1);
2341-
const MCPhysReg &Higher = RegInfo->getSubReg(Reg, 2);
2342-
2343-
// Check only for SuperRegs.
2344-
if (Lower) {
2345-
if (MRI.isPhysRegModified(Higher)) {
2346-
Idx++;
2347-
continue;
2348-
} else {
2338+
MCPhysReg Reg = CalleeSaveReg.getReg();
2339+
MCPhysReg Lower = RegInfo->getSubReg(Reg, 1);
2340+
MCPhysReg Higher = RegInfo->getSubReg(Reg, 2);
2341+
2342+
if ( // Check only for SuperRegs.
2343+
Lower &&
23492344
// Replace Reg if only lower-32 bits modified
2350-
CSI.erase(CSI.begin() + Idx);
2351-
CSI.insert(CSI.begin() + Idx, CalleeSavedInfo(Lower));
2352-
}
2353-
}
2354-
Idx++;
2345+
!MRI.isPhysRegModified(Higher))
2346+
CalleeSaveReg = CalleeSavedInfo(Lower);
23552347
}
23562348
}
23572349

0 commit comments

Comments
 (0)