[llvm] [SelectionDAG] WidenVecOp_INSERT_SUBVECTOR - Replace `INSERT_SUBVECTOR` with series of `INSERT_VECTOR_ELT` (PR #124420)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 27 09:57:30 PST 2025


================
@@ -7070,8 +7073,23 @@ SDValue DAGTypeLegalizer::WidenVecOp_INSERT_SUBVECTOR(SDNode *N) {
     return DAG.getNode(ISD::INSERT_SUBVECTOR, SDLoc(N), VT, InVec, SubVec,
                        N->getOperand(2));
 
-  report_fatal_error("Don't know how to widen the operands for "
-                     "INSERT_SUBVECTOR");
+  // If the operands can't be widened legally, just replace the INSERT_SUBVECTOR
+  // with a series of INSERT_VECTOR_ELT
+  unsigned Idx = N->getConstantOperandVal(2);
+
+  SDValue InsertElt = InVec;
+  SDLoc DL(N);
+  EVT VectorIdxTy = TLI.getVectorIdxTy(DAG.getDataLayout());
+  for (unsigned I = 0; I < OrigVT.getVectorNumElements(); ++I) {
----------------
RKSimon wrote:

(style) `for (unsigned I = 0, E = OrigVT.getVectorNumElements(); I < E; ++I)`

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


More information about the llvm-commits mailing list