Skip to content

[llvm][PowerPC] Correct handling of spill slots for SPE when EXPENSIVE_CHECKS is enabled #73940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 8 additions & 16 deletions llvm/lib/Target/PowerPC/PPCFrameLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2334,24 +2334,16 @@ bool PPCFrameLowering::assignCalleeSavedSpillSlots(
// In case of SPE we only have SuperRegs and CRs
// in our CalleSaveInfo vector.

unsigned Idx = 0;
for (auto &CalleeSaveReg : CSI) {
const MCPhysReg &Reg = CalleeSaveReg.getReg();
const MCPhysReg &Lower = RegInfo->getSubReg(Reg, 1);
const MCPhysReg &Higher = RegInfo->getSubReg(Reg, 2);

// Check only for SuperRegs.
if (Lower) {
if (MRI.isPhysRegModified(Higher)) {
Idx++;
continue;
} else {
MCPhysReg Reg = CalleeSaveReg.getReg();
MCPhysReg Lower = RegInfo->getSubReg(Reg, 1);
MCPhysReg Higher = RegInfo->getSubReg(Reg, 2);

if ( // Check only for SuperRegs.
Lower &&
// Replace Reg if only lower-32 bits modified
CSI.erase(CSI.begin() + Idx);
CSI.insert(CSI.begin() + Idx, CalleeSavedInfo(Lower));
}
}
Idx++;
!MRI.isPhysRegModified(Higher))
CalleeSaveReg = CalleeSavedInfo(Lower);
}
}

Expand Down