@@ -26373,9 +26373,10 @@ performScalarToVectorCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
2637326373/// (shl (and X, C1), C2) -> (and (shl X, C2), (shl C1, C2))
2637426374///
2637526375/// We prefer this canonical form to match existing isel patterns.
26376- static SDValue performSHLCombine(SDNode *N, SelectionDAG &DAG) {
26377- EVT VT = N->getValueType(0);
26378- if (VT != MVT::i32 && VT != MVT::i64)
26376+ static SDValue performSHLCombine(SDNode *N,
26377+ TargetLowering::DAGCombinerInfo &DCI,
26378+ SelectionDAG &DAG) {
26379+ if (DCI.isBeforeLegalizeOps())
2637926380 return SDValue();
2638026381
2638126382 SDValue Op0 = N->getOperand(0);
@@ -26389,13 +26390,14 @@ static SDValue performSHLCombine(SDNode *N, SelectionDAG &DAG) {
2638926390
2639026391 // Might be folded into shifted op, do not lower.
2639126392 if (N->hasOneUse()) {
26392- unsigned UseOpc = N->use_begin ()->getOpcode();
26393+ unsigned UseOpc = N->user_begin ()->getOpcode();
2639326394 if (UseOpc == ISD::ADD || UseOpc == ISD::SUB || UseOpc == ISD::SETCC ||
2639426395 UseOpc == AArch64ISD::ADDS || UseOpc == AArch64ISD::SUBS)
2639526396 return SDValue();
2639626397 }
2639726398
2639826399 SDLoc DL(N);
26400+ EVT VT = N->getValueType(0);
2639926401 SDValue X = Op0->getOperand(0);
2640026402 SDValue NewRHS = DAG.getNode(ISD::SHL, DL, VT, C1, C2);
2640126403 SDValue NewShift = DAG.getNode(ISD::SHL, DL, VT, X, C2);
@@ -26748,7 +26750,7 @@ SDValue AArch64TargetLowering::PerformDAGCombine(SDNode *N,
2674826750 case ISD::SCALAR_TO_VECTOR:
2674926751 return performScalarToVectorCombine(N, DCI, DAG);
2675026752 case ISD::SHL:
26751- return performSHLCombine(N, DAG);
26753+ return performSHLCombine(N, DCI, DAG);
2675226754 }
2675326755 return SDValue();
2675426756}
0 commit comments