[llvm] 294ed6a - [RISCV] Use if init statement to reduce scope of variable. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 08:44:09 PDT 2024
Author: Craig Topper
Date: 2024-08-14T08:37:50-07:00
New Revision: 294ed6a1eb090627441ee0426a64d8f71985fce3
URL: https://github.com/llvm/llvm-project/commit/294ed6a1eb090627441ee0426a64d8f71985fce3
DIFF: https://github.com/llvm/llvm-project/commit/294ed6a1eb090627441ee0426a64d8f71985fce3.diff
LOG: [RISCV] Use if init statement to reduce scope of variable. NFC
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
index ce3a37e194d54..35681c620eed5 100644
--- a/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp
@@ -2978,8 +2978,8 @@ bool RISCVDAGToDAGISel::selectSHXADDOp(SDValue N, unsigned ShAmt,
if (N.getOpcode() == ISD::AND && isa<ConstantSDNode>(N.getOperand(1))) {
SDValue N0 = N.getOperand(0);
- bool LeftShift = N0.getOpcode() == ISD::SHL;
- if ((LeftShift || N0.getOpcode() == ISD::SRL) &&
+ if (bool LeftShift = N0.getOpcode() == ISD::SHL;
+ (LeftShift || N0.getOpcode() == ISD::SRL) &&
isa<ConstantSDNode>(N0.getOperand(1))) {
uint64_t Mask = N.getConstantOperandVal(1);
unsigned C2 = N0.getConstantOperandVal(1);
@@ -3020,11 +3020,9 @@ bool RISCVDAGToDAGISel::selectSHXADDOp(SDValue N, unsigned ShAmt,
}
}
}
- }
-
- bool LeftShift = N.getOpcode() == ISD::SHL;
- if ((LeftShift || N.getOpcode() == ISD::SRL) &&
- isa<ConstantSDNode>(N.getOperand(1))) {
+ } else if (bool LeftShift = N.getOpcode() == ISD::SHL;
+ (LeftShift || N.getOpcode() == ISD::SRL) &&
+ isa<ConstantSDNode>(N.getOperand(1))) {
SDValue N0 = N.getOperand(0);
if (N0.getOpcode() == ISD::AND && N0.hasOneUse() &&
isa<ConstantSDNode>(N0.getOperand(1))) {
More information about the llvm-commits
mailing list