This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Make VReg_1 size be 1
ClosedPublic

Authored by arsenm on Sep 3 2019, 9:55 AM.

Details

Reviewers
rampitec
nhaehnle
Summary

This was getting chosen as the preferred 32-bit register class based
on how TableGen selects subregister classes.

Diff Detail

Event Timeline

arsenm created this revision.Sep 3 2019, 9:55 AM
rampitec added inline comments.Sep 3 2019, 10:55 AM
lib/Target/AMDGPU/SILowerI1Copies.cpp
497

SReg_1 is also 1 bit, but not necessarily 32 on spill.

lib/Target/AMDGPU/SIRegisterInfo.td
685

This is spill size. How does that work when spill size if 1?

arsenm marked an inline comment as done.Sep 3 2019, 10:58 AM
arsenm added inline comments.
lib/Target/AMDGPU/SIRegisterInfo.td
685

VReg_1 should never be seen by a spill. This could also be rounded when spilling

rampitec added inline comments.Sep 3 2019, 11:01 AM
lib/Target/AMDGPU/SIRegisterInfo.td
685

Why are you sure it will never be spilled?
Also if it is never spilled why is this field even matter?

arsenm marked an inline comment as done.Sep 4 2019, 9:21 AM
arsenm added inline comments.
lib/Target/AMDGPU/SIRegisterInfo.td
685

Because this is a hack that exists for SelectionDAG. All uses should be eliminated in SILowerI1Copies. It matters because TableGen uses this as one of the sort and selection field. Without it, it picks VReg_1 instead of VGPR_32 as the preferred 32-bit register class

rampitec added inline comments.Sep 4 2019, 3:19 PM
lib/Target/AMDGPU/SIRegisterInfo.td
685

OK, makes sense. What about SReg_1 handling in the comment above, in the isRegister32()?

arsenm marked an inline comment as done.Sep 6 2019, 9:14 AM
arsenm added inline comments.
lib/Target/AMDGPU/SIRegisterInfo.td
685

Contextually, I think that would already be illegal so I don't think this assert should worry about it. That would be a VGPR->SGPR copy that would error elsewhere

rampitec added inline comments.Sep 6 2019, 11:33 AM
lib/Target/AMDGPU/SIRegisterInfo.td
685

Assert probably fine, but the function is called isRegister32 and someone may eventually want to reuse it with unexpected consequences.

arsenm updated this revision to Diff 219378.Sep 9 2019, 9:49 AM

Rename assert function

rampitec accepted this revision.Sep 9 2019, 9:52 AM

LGTM

This revision is now accepted and ready to land.Sep 9 2019, 9:52 AM
arsenm closed this revision.Sep 9 2019, 11:42 AM

r371438