[llvm] [GlobalISel] Make scalar G_SHUFFLE_VECTOR illegal. (PR #140508)

Alan Li via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 10:26:59 PDT 2025


================
@@ -784,9 +784,9 @@ MachineInstrBuilder MachineIRBuilder::buildShuffleVector(const DstOp &Res,
   LLT DstTy = Res.getLLTTy(*getMRI());
   LLT Src1Ty = Src1.getLLTTy(*getMRI());
   LLT Src2Ty = Src2.getLLTTy(*getMRI());
-  const LLT DstElemTy = DstTy.isVector() ? DstTy.getElementType() : DstTy;
-  const LLT ElemTy1 = Src1Ty.isVector() ? Src1Ty.getElementType() : Src1Ty;
-  const LLT ElemTy2 = Src2Ty.isVector() ? Src2Ty.getElementType() : Src2Ty;
+  const LLT DstElemTy = DstTy.getScalarType();
----------------
lialan wrote:

When building a new `ShuffleVector`, should check that `len(mask) > 1` to avoid accidentally yielding a new scalar.

https://github.com/llvm/llvm-project/pull/140508


More information about the llvm-commits mailing list