[llvm-dev] TargetRegisterInfo::getCommonSubClass bug, perhaps.

Quentin Colombet via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 28 09:25:54 PDT 2019

I was going to say that you should check what arguments you get from getCommonSubClass and where it comes from for the faulty call, because per the instruction description, ISel is supposed to constrain your destination to SGPR32, but actually, you’re problem is much simpler.

Looking back at your register classes descriptions, both SGPR32 and SFGPR32 contains the exact same set of registers. Thus, for the purpose of constraining the arguments it does not matter which one is being used.
You should make them truly disjoint if you don’t want them to be used interchangeably.

> On Aug 27, 2019, at 7:06 PM, Nancy <nancydreaming at gmail.com> wrote:
>> That doesn’t sound problematic. getCommonSubClass should have enough information to get the right register class from A and B.
>> What is your description of ADDrr. It sounds to me that you allowed ADDrr destination to use SFGPR32 and that would be your problem.
>> Cheers,
>> -Quentin
> I only allowed ADDrr use SGPR32 register class. Here's fragment of
> llvm-tblgen -print-records infos.
> def ADDrr {    // Instruction ABCInst ABCInstPErr
> ....
>  string Namespace = "ABC";
>  dag OutOperandList = (outs SGPR32:$vx);
>  dag InOperandList = (ins SGPR32:$rs1, SGPR32:$rs2);
>  string AsmString = "ADD.U32    $rs1, $rs2, $vx";
> ....
> -- 
> Best Regards,
> Yu Rong Tan

More information about the llvm-dev mailing list