[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:47:54 PDT 2023
craig.topper created this revision.
craig.topper added reviewers: asb, reames, wangpc.
Herald added subscribers: jobnoorman, luke, VincentWu, vkmr, frasercrmck, luismarques, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya, arichardson.
Herald added a project: All.
craig.topper requested review of this revision.
Herald added subscribers: eopXD, MaskRay.
Herald added a project: LLVM.
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.
Repository:
rG LLVM Github Monorepo
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.540758.patch
Type: text/x-patch
Size: 3453 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230716/077fc6b8/attachment.bin>
More information about the llvm-commits
mailing list