@@ -26373,9 +26373,10 @@ performScalarToVectorCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
26373
26373
/// (shl (and X, C1), C2) -> (and (shl X, C2), (shl C1, C2))
26374
26374
///
26375
26375
/// 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())
26379
26380
return SDValue();
26380
26381
26381
26382
SDValue Op0 = N->getOperand(0);
@@ -26389,13 +26390,14 @@ static SDValue performSHLCombine(SDNode *N, SelectionDAG &DAG) {
26389
26390
26390
26391
// Might be folded into shifted op, do not lower.
26391
26392
if (N->hasOneUse()) {
26392
- unsigned UseOpc = N->use_begin ()->getOpcode();
26393
+ unsigned UseOpc = N->user_begin ()->getOpcode();
26393
26394
if (UseOpc == ISD::ADD || UseOpc == ISD::SUB || UseOpc == ISD::SETCC ||
26394
26395
UseOpc == AArch64ISD::ADDS || UseOpc == AArch64ISD::SUBS)
26395
26396
return SDValue();
26396
26397
}
26397
26398
26398
26399
SDLoc DL(N);
26400
+ EVT VT = N->getValueType(0);
26399
26401
SDValue X = Op0->getOperand(0);
26400
26402
SDValue NewRHS = DAG.getNode(ISD::SHL, DL, VT, C1, C2);
26401
26403
SDValue NewShift = DAG.getNode(ISD::SHL, DL, VT, X, C2);
@@ -26748,7 +26750,7 @@ SDValue AArch64TargetLowering::PerformDAGCombine(SDNode *N,
26748
26750
case ISD::SCALAR_TO_VECTOR:
26749
26751
return performScalarToVectorCombine(N, DCI, DAG);
26750
26752
case ISD::SHL:
26751
- return performSHLCombine(N, DAG);
26753
+ return performSHLCombine(N, DCI, DAG);
26752
26754
}
26753
26755
return SDValue();
26754
26756
}
0 commit comments