[llvm] [RISCV] Update matchSplatAsGather to convert vectors if they have different sizes (PR #117878)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 2 17:28:33 PST 2024


================
@@ -3496,21 +3496,30 @@ static SDValue matchSplatAsGather(SDValue SplatVal, MVT VT, const SDLoc &DL,
   if (SplatVal.getOpcode() != ISD::EXTRACT_VECTOR_ELT)
     return SDValue();
   SDValue Vec = SplatVal.getOperand(0);
-  // Only perform this optimization on vectors of the same size for simplicity.
   // Don't perform this optimization for i1 vectors.
   // FIXME: Support i1 vectors, maybe by promoting to i8?
-  if (Vec.getValueType() != VT || VT.getVectorElementType() == MVT::i1)
+  if (VT.getVectorElementType() == MVT::i1)
+    return SDValue();
+  // Additionally the element types should match
+  if (Vec.getSimpleValueType().getVectorElementType() !=
----------------
lukel97 wrote:

Nit, could you move this back into the above if statement since both are checking the element type

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


More information about the llvm-commits mailing list