[RegisterClassInfo] Return non-zero for RC without allocatable reg
authorJinsong Ji <jji@us.ibm.com>
Tue, 5 Jan 2021 15:37:16 +0000 (15:37 +0000)
committerJinsong Ji <jji@us.ibm.com>
Tue, 5 Jan 2021 16:18:34 +0000 (16:18 +0000)
commitf26bc0ddd508edad7e3838850dfcb6b960d6e681
treeb63b47468a7d84e4b0714015eb299fe58f3a79a4
parent51d5991f04dda76c2f07123569b5c31ed3dfcfe8
[RegisterClassInfo] Return non-zero for RC without allocatable reg

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.

Reviewed By: RKSimon

Differential Revision: https://reviews.llvm.org/D92907
llvm/lib/CodeGen/RegisterClassInfo.cpp
llvm/test/CodeGen/PowerPC/compute-regpressure.ll