aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@sifive.com>2025-01-09 18:05:41 -0800
committerGitHub <noreply@github.com>2025-01-09 18:05:41 -0800
commit41e4018f9c858af15c4fe0ea0d1de8ff4602071e (patch)
treef17c6cd0ac69e7d155935f1838c4e83ba6f32746
parentb11fe33aea82444387422e550e10f1fba5bcfaa3 (diff)
downloadllvm-41e4018f9c858af15c4fe0ea0d1de8ff4602071e.zip
llvm-41e4018f9c858af15c4fe0ea0d1de8ff4602071e.tar.gz
llvm-41e4018f9c858af15c4fe0ea0d1de8ff4602071e.tar.bz2
[RISCV][VLOPT] Simplify code by removing extra temporary variables. NFC (#122333)
Just do the conditional operator in the return statement.
-rw-r--r--llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp15
1 files changed, 5 insertions, 10 deletions
diff --git a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
index 9338e0a..69ee210 100644
--- a/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
+++ b/llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp
@@ -550,10 +550,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:
@@ -571,8 +569,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
@@ -613,8 +610,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
@@ -728,8 +724,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: