Skip to content

Commit 294ed6a

Browse files
committed
[RISCV] Use if init statement to reduce scope of variable. NFC
1 parent 20b2c9f commit 294ed6a

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2978,8 +2978,8 @@ bool RISCVDAGToDAGISel::selectSHXADDOp(SDValue N, unsigned ShAmt,
29782978
if (N.getOpcode() == ISD::AND && isa<ConstantSDNode>(N.getOperand(1))) {
29792979
SDValue N0 = N.getOperand(0);
29802980

2981-
bool LeftShift = N0.getOpcode() == ISD::SHL;
2982-
if ((LeftShift || N0.getOpcode() == ISD::SRL) &&
2981+
if (bool LeftShift = N0.getOpcode() == ISD::SHL;
2982+
(LeftShift || N0.getOpcode() == ISD::SRL) &&
29832983
isa<ConstantSDNode>(N0.getOperand(1))) {
29842984
uint64_t Mask = N.getConstantOperandVal(1);
29852985
unsigned C2 = N0.getConstantOperandVal(1);
@@ -3020,11 +3020,9 @@ bool RISCVDAGToDAGISel::selectSHXADDOp(SDValue N, unsigned ShAmt,
30203020
}
30213021
}
30223022
}
3023-
}
3024-
3025-
bool LeftShift = N.getOpcode() == ISD::SHL;
3026-
if ((LeftShift || N.getOpcode() == ISD::SRL) &&
3027-
isa<ConstantSDNode>(N.getOperand(1))) {
3023+
} else if (bool LeftShift = N.getOpcode() == ISD::SHL;
3024+
(LeftShift || N.getOpcode() == ISD::SRL) &&
3025+
isa<ConstantSDNode>(N.getOperand(1))) {
30283026
SDValue N0 = N.getOperand(0);
30293027
if (N0.getOpcode() == ISD::AND && N0.hasOneUse() &&
30303028
isa<ConstantSDNode>(N0.getOperand(1))) {

0 commit comments

Comments
 (0)