[PATCH] D155390: [RISCV] Move comments before 'if' instead of after. NFC

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 15 22:54:05 PDT 2023


This revision was not accepted when it landed; it landed in state "Needs Review".
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGef1ccc493e61: [RISCV] Move comments before 'if' instead of after. NFC (authored by craig.topper).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D155390/new/

https://reviews.llvm.org/D155390

Files:
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp


Index: llvm/lib/Target/RISCV/RISCVISelLowering.cpp
===================================================================
--- llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -5907,11 +5907,11 @@
   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 @@
           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 @@
           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),


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155390.540759.patch
Type: text/x-patch
Size: 3453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230716/b80121e6/attachment.bin>


More information about the llvm-commits mailing list