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