hi,
When I create a new vector const with following code, I’ll get a MachineInstr %0:(<2 x s32>) = G_BUILD_VECTOR %1:(s32), %2:_(s32) missing regbank information, this is different from the normal format %0:fpr(<2 x s32>) = G_BUILD_VECTOR %1:gpr(s32), %2:gpr(s32), so how to add related regbank information or is the wrong interface used ?
oh, the regbank will be added with setRegBank, but it still report LLVM ERROR: VReg has no regclass after selection: %3:fpr(<2 x s32>) = G_BUILD_VECTOR %4:gpr(s32), %6:gpr(s32) in InstructionSelect
auto C0 = MIB.buildConstant(S32 , 0);
MRI.setRegBank(C0.getReg(0), RBI.getRegBank(AArch64::GPRRegBankID));
auto C1 = MIB.buildConstant(S32 , 1);
MRI.setRegBank(C1.getReg(0), RBI.getRegBank(AArch64::GPRRegBankID));
auto Concat2 = MIB.buildBuildVector(DstTy, {C0.getReg(0), C1.getReg(0)});
Even for the simple case, I only try to add a unused node, it still report the similar issue. LLVM ERROR: VReg has no regclass after selection: %4:gpr(s32) = G_CONSTANT i32 0
New error unknown operand type in function lowerOperand because the const type is “MachineOperand::MO_CImmediate” after adding MRI.setRegClass(C0.getReg(0), &AArch64::GPR64RegClass) to fix above " LLVM ERROR: VReg has no regclass after selection"
You’re looking at code that’s too early. The error is telling you the instruction wasn’t properly selected. The register banks need to be constrained to a real instruction with final register classes during the selection pass. You’ve somehow let a generic instruction get past selection