================
@@ -2106,6 +2104,23 @@ bool SPIRVInstructionSelector::selectStore(MachineInstr 
&I) const {
     }
   }
 
+  SPIRVTypeInst PointeeTy = GR.getPointeeType(GR.getSPIRVTypeForVReg(Ptr));
+  SPIRVTypeInst StoreTy = GR.getSPIRVTypeForVReg(StoreVal);
+  if (PointeeTy->getOpcode() == SPIRV::OpTypeVectorIdEXT &&
+      StoreTy->getOpcode() != SPIRV::OpTypeVectorIdEXT &&
+      GR.getScalarOrVectorComponentCount(PointeeTy) == 1) {
+    MachineInstr *StoreValDef = getVRegDef(*MRI, StoreVal);
+    Register Reg = StoreValDef->getOperand(0).getReg();
+    if (auto FC = GFConstant::getConstant(Reg, *MRI))
+      StoreVal =
+          GR.getOrCreateConstVector(FC->getScalarValue(), I, PointeeTy, TII);
+    else if (auto IC = GIConstant::getConstant(Reg, *MRI))
+      StoreVal =
+          GR.getOrCreateConstVector(IC->getScalarValue(), I, PointeeTy, TII);
+    else
+      llvm_unreachable("Unexpected <1 x T> Store type!");
----------------
AlexVlx wrote:

Not sure, why, what?:) <1 x T> `splat`s get IRTranslated into simple scalars, 
however this doesn't quite work when you do a store as the pointer type would 
mismatch, so we have to retrieve the vector-ness here.

https://github.com/llvm/llvm-project/pull/210279
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to