This is an archive of the discontinued LLVM Phabricator instance.

[RegisterClassInfo] Return non-zero for RC without allocatable reg
ClosedPublic

Authored by jsji on Dec 8 2020, 8:15 PM.

Details

Summary

In some case, the RC may have 0 allocatable reg.
eg: VRSAVERC in PowerPC, which has only 1 reg, but it is also reserved.

The curreent implementation will keep calling the computePSetLimit because
getRegPressureSetLimit assume computePSetLimit will return a non-zero value.

The fix simply early return the value from TableGen for such special case.

Diff Detail

Event Timeline

jsji created this revision.Dec 8 2020, 8:15 PM
jsji requested review of this revision.Dec 8 2020, 8:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 8 2020, 8:15 PM
jsji added a comment.Dec 15 2020, 11:24 AM

Gentle ping...

jsji added a reviewer: lkail.Jan 4 2021, 7:04 AM

Gentle ping...

RKSimon added inline comments.Jan 4 2021, 7:11 AM
llvm/lib/CodeGen/RegisterClassInfo.cpp
190–191

Pull out the repeated getNumAllocatableRegs and getRegPressureSetLimit calls.

jsji updated this revision to Diff 314395.Jan 4 2021, 9:14 AM

Address comments. Thanks Simon.

RKSimon accepted this revision.Jan 5 2021, 5:39 AM

LGTM with one minor

llvm/lib/CodeGen/RegisterClassInfo.cpp
193

Please can you add a comment explaining the early-out?

This revision is now accepted and ready to land.Jan 5 2021, 5:39 AM
jsji updated this revision to Diff 314610.Jan 5 2021, 7:42 AM

Add comments.

jsji updated this revision to Diff 314613.Jan 5 2021, 7:51 AM

Update comments.

This revision was landed with ongoing or failed builds.Jan 5 2021, 8:19 AM
This revision was automatically updated to reflect the committed changes.