[llvm] ef1ccc4 - [RISCV] Move comments before 'if' instead of after. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sat Jul 15 22:53:51 PDT 2023
Author: Craig Topper
Date: 2023-07-15T22:47:52-07:00
New Revision: ef1ccc493e6167488ac10da2842fa7cac2746565
URL: https://github.com/llvm/llvm-project/commit/ef1ccc493e6167488ac10da2842fa7cac2746565
DIFF: https://github.com/llvm/llvm-project/commit/ef1ccc493e6167488ac10da2842fa7cac2746565.diff
LOG: [RISCV] Move comments before 'if' instead of after. NFC
This allows us to remove some curly braces around the if body.
The code wasn't consistent about it anyway. Comments before is
used in other places in this file already.
Differential Revision: https://reviews.llvm.org/D155390
Added:
Modified:
llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 32752789f982a6..0a250f495f1a1a 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -5907,11 +5907,11 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
if (Subtarget.hasStdExtZicond() && VT.isInteger()) {
SDValue NewCondV;
if (selectSETCC(CondV, ISD::SETNE, NewCondV, DAG)) {
+ // (select (riscv_setne c), t, 0) -> (czero_eqz t, c)
if (isNullConstant(FalseV))
- // (select (riscv_setne c), t, 0) -> (czero_eqz t, c)
return DAG.getNode(RISCVISD::CZERO_EQZ, DL, VT, TrueV, NewCondV);
+ // (select (riscv_setne c), 0, f) -> (czero_nez f, c)
if (isNullConstant(TrueV))
- // (select (riscv_setne c), 0, f) -> (czero_nez f, c)
return DAG.getNode(RISCVISD::CZERO_NEZ, DL, VT, FalseV, NewCondV);
// (select (riscv_setne c), t, f) -> (or (czero_eqz t, c), (czero_nez f,
// c)
@@ -5921,11 +5921,11 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
DAG.getNode(RISCVISD::CZERO_NEZ, DL, VT, FalseV, NewCondV));
}
if (selectSETCC(CondV, ISD::SETEQ, NewCondV, DAG)) {
+ // (select (riscv_seteq c), t, 0) -> (czero_nez t, c)
if (isNullConstant(FalseV))
- // (select (riscv_seteq c), t, 0) -> (czero_nez t, c)
return DAG.getNode(RISCVISD::CZERO_NEZ, DL, VT, TrueV, NewCondV);
+ // (select (riscv_seteq c), 0, f) -> (czero_eqz f, c)
if (isNullConstant(TrueV))
- // (select (riscv_seteq c), 0, f) -> (czero_eqz f, c)
return DAG.getNode(RISCVISD::CZERO_EQZ, DL, VT, FalseV, NewCondV);
// (select (riscv_seteq c), t, f) -> (or (czero_eqz f, c), (czero_nez t,
// c)
@@ -5934,28 +5934,27 @@ SDValue RISCVTargetLowering::lowerSELECT(SDValue Op, SelectionDAG &DAG) const {
DAG.getNode(RISCVISD::CZERO_EQZ, DL, VT, FalseV, NewCondV),
DAG.getNode(RISCVISD::CZERO_NEZ, DL, VT, TrueV, NewCondV));
}
- if (isNullConstant(FalseV)) {
- // (select c, t, 0) -> (czero_eqz t, c)
+
+ // (select c, t, 0) -> (czero_eqz t, c)
+ if (isNullConstant(FalseV))
return DAG.getNode(RISCVISD::CZERO_EQZ, DL, VT, TrueV, CondV);
- }
- if (isNullConstant(TrueV)) {
- // (select c, 0, f) -> (czero_nez f, c)
+ // (select c, 0, f) -> (czero_nez f, c)
+ if (isNullConstant(TrueV))
return DAG.getNode(RISCVISD::CZERO_NEZ, DL, VT, FalseV, CondV);
- }
+
+ // (select c, (and f, x), f) -> (or (and f, x), (czero_nez f, c))
if (TrueV.getOpcode() == ISD::AND &&
- (TrueV.getOperand(0) == FalseV || TrueV.getOperand(1) == FalseV)) {
- // (select c, (and f, x), f) -> (or (and f, x), (czero_nez f, c))
+ (TrueV.getOperand(0) == FalseV || TrueV.getOperand(1) == FalseV))
return DAG.getNode(
ISD::OR, DL, VT, TrueV,
DAG.getNode(RISCVISD::CZERO_NEZ, DL, VT, FalseV, CondV));
- }
+ // (select c, t, (and t, x)) -> (or (czero_eqz t, c), (and t, x))
if (FalseV.getOpcode() == ISD::AND &&
- (FalseV.getOperand(0) == TrueV || FalseV.getOperand(1) == TrueV)) {
- // (select c, t, (and t, x)) -> (or (czero_eqz t, c), (and t, x))
+ (FalseV.getOperand(0) == TrueV || FalseV.getOperand(1) == TrueV))
return DAG.getNode(
ISD::OR, DL, VT, FalseV,
DAG.getNode(RISCVISD::CZERO_EQZ, DL, VT, TrueV, CondV));
- }
+
// (select c, t, f) -> (or (czero_eqz t, c), (czero_nez f, c))
return DAG.getNode(ISD::OR, DL, VT,
DAG.getNode(RISCVISD::CZERO_EQZ, DL, VT, TrueV, CondV),
More information about the llvm-commits
mailing list