Skip to content

Commit 4d60272

Browse files
committed
Pull calls to getSubReg out of loop
1 parent 08d70a9 commit 4d60272

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Target/AMDGPU/SILowerSGPRSpills.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,15 +267,16 @@ bool SILowerSGPRSpills::spillCalleeSavedRegs(
267267

268268
std::vector<CalleeSavedInfo> CSI;
269269
const MCPhysReg *CSRegs = MRI.getCalleeSavedRegs();
270-
Register RetAddrReg = TRI->getReturnAddressReg(MF);
270+
MCRegister RetAddrReg = TRI->getReturnAddressReg(MF);
271+
MCRegister RetAddrRegSub0 = TRI->getSubReg(RetAddrReg, AMDGPU::sub0);
272+
MCRegister RetAddrRegSub1 = TRI->getSubReg(RetAddrReg, AMDGPU::sub1);
271273
bool SpillRetAddrReg = false;
272274

273275
for (unsigned I = 0; CSRegs[I]; ++I) {
274276
MCRegister Reg = CSRegs[I];
275277

276278
if (SavedRegs.test(Reg)) {
277-
if (Reg == TRI->getSubReg(RetAddrReg, AMDGPU::sub0) ||
278-
Reg == TRI->getSubReg(RetAddrReg, AMDGPU::sub1)) {
279+
if (Reg == RetAddrRegSub0 || Reg == RetAddrRegSub1) {
279280
SpillRetAddrReg = true;
280281
continue;
281282
}

0 commit comments

Comments
 (0)