This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU: Make VReg_1 only include 1 artificial register
ClosedPublic

Authored by arsenm on Oct 28 2019, 1:05 PM.

Details

Reviewers
rampitec
Summary

When TableGen is inferring register classes from contexts, it uses a
sorting function based on the number of registers in the class. Since
this was being treated as an alias of VGPR_32, they had exactly the
same size. The sort used wasn't a stable sort, and even if it were, I
believe the tie breaker would effectively end up being the
alphabetical ordering of the class name. There appear to be issues
trying to use an empty set of registers, so add only one so this will
always sort to the end.

Also add a comment explaining how VReg_1 is a dirty hack for
SelectionDAG.

This does end up changing the behavior of i1 with inline asm and VGPR
constraints, but the existing behavior was was already nonsensical and
inconsistent. It should probably be disallowed anyway.

Fixes bug 43699

Diff Detail

Event Timeline

arsenm created this revision.Oct 28 2019, 1:05 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 28 2019, 1:05 PM
rampitec added inline comments.Oct 28 2019, 1:20 PM
llvm/lib/Target/AMDGPU/SIRegisterInfo.td
690

isAllocatable = 0 maybe?

arsenm marked an inline comment as done.Oct 28 2019, 1:31 PM
arsenm added inline comments.
llvm/lib/Target/AMDGPU/SIRegisterInfo.td
690

That applies to register classes, not registers. The class also does need to be allocatable, since we need to create virtual registers with it

This revision is now accepted and ready to land.Oct 28 2019, 1:38 PM