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