This is an archive of the discontinued LLVM Phabricator instance.

Remove duplicate fields in RAGreedy
ClosedPublic

Authored by qunyanm on May 18 2022, 1:21 PM.

Details

Summary

RAGreedy has two fields of RegisterClassInfo, one called RCI and another RegClassInfo from its base class.
RCI is initialized without freezeReservedRegs first, while RegClassInfo does. Therefore, if reserved registers
information is changed between last time freezeReservedRegs is called and RAGreedy, it's not picked up by RCI.
Instead of having both fields in RAGreedy, remove RCI and use RegClassInfo instead. Also removed is the TRI field
which is present in its base class.

Diff Detail

Event Timeline

qunyanm created this revision.May 18 2022, 1:21 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 1:21 PM
qunyanm requested review of this revision.May 18 2022, 1:22 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 1:22 PM
qunyanm added a subscriber: qunyanm.
MatzeB accepted this revision.May 18 2022, 1:34 PM

Nice catch! LGTM.

This revision is now accepted and ready to land.May 18 2022, 1:34 PM

Therefore, if reserved registers information is changed between last time freezeReservedRegs is called and RAGreedy, it's not picked up by RCI.

That is surprising, shouldn't you trigger an assert in MachineRegisterInfo::getReservedRegs if reserved regs are queried before freezeReservedRegs is called?

(of course this change is good regardless)

qunyanm added a comment.EditedMay 18 2022, 1:52 PM

I don't think we have unfreeze so once you freeze it once anywhere in a pass before RAGreedy, the assert won't trigger.

Can someone help me commit it? I don't have the permission.

This revision was automatically updated to reflect the committed changes.