[llvm] [RISCV][VLOPT] Simplify code by removing extra temporary variables. NFC (PR #122333)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 9 10:47:32 PST 2025
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/122333
Just do the conditional operator in the return statement.
>From 378226e4d5e5227f9aba859433f634b34be61da2 Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Thu, 9 Jan 2025 10:46:11 -0800
Subject: [PATCH] [RISCV][VLOPT] Simplify code by removing extra temporary
variables. NFC
Just do the conditional operator in the return statement.
---
llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
index 9a0938bc38dd45..5025fd27a939c9 100644
--- a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
@@ -546,10 +546,8 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
case RISCV::VFWCVT_RTZ_X_F_V:
case RISCV::VFWCVT_F_XU_V:
case RISCV::VFWCVT_F_X_V:
- case RISCV::VFWCVT_F_F_V: {
- unsigned Log2EEW = IsMODef ? MILog2SEW + 1 : MILog2SEW;
- return Log2EEW;
- }
+ case RISCV::VFWCVT_F_F_V:
+ return IsMODef ? MILog2SEW + 1 : MILog2SEW;
// Def and Op1 uses EEW=2*SEW. Op2 uses EEW=SEW.
case RISCV::VWADDU_WV:
@@ -567,8 +565,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
case RISCV::VFWSUB_WV: {
bool IsOp1 = HasPassthru ? MO.getOperandNo() == 2 : MO.getOperandNo() == 1;
bool TwoTimes = IsMODef || IsOp1;
- unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
- return Log2EEW;
+ return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
}
// Vector Integer Extension
@@ -609,8 +606,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
case RISCV::VFNCVT_ROD_F_F_W: {
bool IsOp1 = HasPassthru ? MO.getOperandNo() == 2 : MO.getOperandNo() == 1;
bool TwoTimes = IsOp1;
- unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
- return Log2EEW;
+ return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
}
// Vector Mask Instructions
@@ -724,8 +720,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
case RISCV::VFWREDOSUM_VS:
case RISCV::VFWREDUSUM_VS: {
bool TwoTimes = IsMODef || MO.getOperandNo() == 3;
- unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
- return Log2EEW;
+ return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
}
default:
More information about the llvm-commits
mailing list