@@ -3868,7 +3868,8 @@ static SDValue foldSubCtlzNot(SDNode *N, SelectionDAG &DAG) {
38683868}
38693869
38703870// Fold sub(x, mul(divrem(x,y)[0], y)) to divrem(x, y)[1]
3871- static SDValue foldRemainderIdiom(SDNode *N, SelectionDAG &DAG, SDLoc &DL) {
3871+ static SDValue foldRemainderIdiom(SDNode *N, SelectionDAG &DAG,
3872+ const SDLoc &DL) {
38723873 assert(N->getOpcode() == ISD::SUB && "Node must be a SUB");
38733874 SDValue Sub0 = N->getOperand(0);
38743875 SDValue Sub1 = N->getOperand(1);
@@ -3888,12 +3889,10 @@ static SDValue foldRemainderIdiom(SDNode *N, SelectionDAG &DAG, SDLoc &DL) {
38883889 SDValue Mul0 = Sub1.getOperand(0);
38893890 SDValue Mul1 = Sub1.getOperand(1);
38903891
3891- SDValue Res = CheckAndFoldMulCase(Mul0, Mul1);
3892- if (Res)
3892+ if (SDValue Res = CheckAndFoldMulCase(Mul0, Mul1))
38933893 return Res;
38943894
3895- Res = CheckAndFoldMulCase(Mul1, Mul0);
3896- if (Res)
3895+ if (SDValue Res = CheckAndFoldMulCase(Mul1, Mul0))
38973896 return Res;
38983897
38993898 } else if (Sub1.getOpcode() == ISD::SHL) {
@@ -3909,14 +3908,12 @@ static SDValue foldRemainderIdiom(SDNode *N, SelectionDAG &DAG, SDLoc &DL) {
39093908
39103909 ConstantSDNode *DivC = isConstOrConstSplat(Divisor);
39113910 ConstantSDNode *ShC = isConstOrConstSplat(Shl1);
3912- if (!DivC || !ShC) {
3911+ if (!DivC || !ShC)
39133912 return SDValue();
3914- }
39153913
39163914 if (DivC->getAPIntValue().isPowerOf2() &&
3917- DivC->getAPIntValue().logBase2() == ShC->getAPIntValue()) {
3915+ DivC->getAPIntValue().logBase2() == ShC->getAPIntValue())
39183916 return SDValue(Shl0.getNode(), 1);
3919- }
39203917 }
39213918 }
39223919 return SDValue();
0 commit comments