@@ -14314,8 +14314,10 @@ static SDValue transformAddShlImm(SDNode *N, SelectionDAG &DAG,
1431414314 return DAG.getNode(ISD::SHL, DL, VT, SHADD, DAG.getConstant(Bits, DL, VT));
1431514315}
1431614316
14317- // Check if this SDValue is an add immediate that is fed by a shift of 1, 2, or 3.
14318- static bool checkAddiForShift(SDValue AddI, int64_t &AddConst, int64_t &ShlConst) {
14317+ // Check if this SDValue is an add immediate that is fed by a shift of 1, 2,
14318+ // or 3.
14319+ static bool checkAddiForShift(SDValue AddI, int64_t &AddConst,
14320+ int64_t &ShlConst) {
1431914321 // Based on testing it seems that performance degrades if the ADDI has
1432014322 // more than 2 uses.
1432114323 if (AddI->use_size() > 2)
@@ -14373,14 +14375,15 @@ static SDValue combineShlAddIAdd(SDNode *N, SelectionDAG &DAG,
1437314375 if (!LHSIsAddI && !RHSIsAddI)
1437414376 return SDValue();
1437514377
14376- // If the LHS is not the result of an add or both sides are results of an add, but
14377- // the LHS does not have the desired structure with a shift, swap the operands.
14378+ // If the LHS is not the result of an add or both sides are results of an add,
14379+ // but the LHS does not have the desired structure with a shift, swap the
14380+ // operands.
1437814381 if (!LHSIsAddI || (RHSIsAddI && !checkAddiForShift(AddI, AddConst, ShlConst)))
1437914382 std::swap(AddI, Other);
1438014383
1438114384 // We simply need to ensure AddI has the desired structure.
1438214385 if (!checkAddiForShift(AddI, AddConst, ShlConst))
14383- return SDValue();
14386+ return SDValue();
1438414387
1438514388 SDValue SHLVal = AddI->getOperand(0);
1438614389 SDLoc DL(N);
0 commit comments