@@ -27524,18 +27524,11 @@ static SDValue scalarizeBinOpOfSplats(SDNode *N, SelectionDAG &DAG,
2752427524
2752527525 // If all lanes but 1 are undefined, no need to splat the scalar result.
2752627526 // TODO: Keep track of undefs and use that info in the general case.
27527- if (N0.getOpcode() == ISD::BUILD_VECTOR && N0.getOpcode() == N1.getOpcode() &&
27528- // This is assuming if either input is undef, the result will fold out.
27529- //
27530- // TODO: Do we need to check if the opcode/operand propagates undef?
27531- // Should we ignore operation identity values?
27532- ((count_if(N0->ops(), [](SDValue V) { return !V.isUndef(); }) == 1) ||
27533- (count_if(N1->ops(), [](SDValue V) { return !V.isUndef(); }) == 1))) {
27527+ if (N0.getOpcode() == ISD::BUILD_VECTOR && N0.getOpcode() == N1.getOpcode()) {
2753427528 // bo (build_vec ..undef, X, undef...), (build_vec ..undef, Y, undef...) -->
27535- // build_vec ..undef, (bo X, Y), undef...
27536- SmallVector<SDValue, 8> Ops(VT.getVectorNumElements(), DAG.getUNDEF(EltVT));
27537- Ops[Index0] = ScalarBO;
27538- return DAG.getBuildVector(VT, DL, Ops);
27529+ // insert_vector_elt undef, (bo X, Y), index
27530+ return DAG.getNode(ISD::INSERT_VECTOR_ELT, DL, VT, DAG.getUNDEF(VT),
27531+ ScalarBO, IndexC);
2753927532 }
2754027533
2754127534 // bo (splat X, Index), (splat Y, Index) --> splat (bo X, Y), Index
0 commit comments