@@ -2162,6 +2162,7 @@ bool SPIRVInstructionSelector::selectBuildVector(Register ResVReg,
21622162 report_fatal_error (
21632163 " There must be at least two constituent operands in a vector" );
21642164
2165+ MRI->setRegClass (ResVReg, GR.getRegClass (ResType));
21652166 auto MIB = BuildMI (*I.getParent (), I, I.getDebugLoc (),
21662167 TII.get (IsConst ? SPIRV::OpConstantComposite
21672168 : SPIRV::OpCompositeConstruct))
@@ -2195,6 +2196,7 @@ bool SPIRVInstructionSelector::selectSplatVector(Register ResVReg,
21952196 report_fatal_error (
21962197 " There must be at least two constituent operands in a vector" );
21972198
2199+ MRI->setRegClass (ResVReg, GR.getRegClass (ResType));
21982200 auto MIB = BuildMI (*I.getParent (), I, I.getDebugLoc (),
21992201 TII.get (IsConst ? SPIRV::OpConstantComposite
22002202 : SPIRV::OpCompositeConstruct))
@@ -2701,7 +2703,7 @@ bool SPIRVInstructionSelector::wrapIntoSpecConstantOp(
27012703 continue ;
27022704 }
27032705 // Create a new register for the wrapper
2704- WrapReg = MRI->createVirtualRegister (&SPIRV::iIDRegClass );
2706+ WrapReg = MRI->createVirtualRegister (GR. getRegClass (OpType) );
27052707 GR.add (OpDefine, MF, WrapReg);
27062708 CompositeArgs.push_back (WrapReg);
27072709 // Decorate the wrapper register and generate a new instruction
@@ -2766,6 +2768,7 @@ bool SPIRVInstructionSelector::selectIntrinsic(Register ResVReg,
27662768 if (!wrapIntoSpecConstantOp (I, CompositeArgs))
27672769 return false ;
27682770 }
2771+ MRI->setRegClass (ResVReg, GR.getRegClass (ResType));
27692772 auto MIB = BuildMI (BB, I, I.getDebugLoc (), TII.get (Opcode))
27702773 .addDef (ResVReg)
27712774 .addUse (GR.getSPIRVTypeID (ResType));
@@ -3388,7 +3391,10 @@ bool SPIRVInstructionSelector::selectPhi(Register ResVReg,
33883391 MIB.addUse (I.getOperand (i + 0 ).getReg ());
33893392 MIB.addMBB (I.getOperand (i + 1 ).getMBB ());
33903393 }
3391- return MIB.constrainAllUses (TII, TRI, RBI);
3394+ bool Res = MIB.constrainAllUses (TII, TRI, RBI);
3395+ MIB->setDesc (TII.get (TargetOpcode::PHI));
3396+ MIB->removeOperand (1 );
3397+ return Res;
33923398}
33933399
33943400bool SPIRVInstructionSelector::selectGlobalValue (
0 commit comments