Skip to content

Commit 378226e

Browse files
committed
[RISCV][VLOPT] Simplify code by removing extra temporary variables. NFC
Just do the conditional operator in the return statement.
1 parent 69b54c1 commit 378226e

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

llvm/lib/Target/RISCV/RISCVVLOptimizer.cpp

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -546,10 +546,8 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
546546
case RISCV::VFWCVT_RTZ_X_F_V:
547547
case RISCV::VFWCVT_F_XU_V:
548548
case RISCV::VFWCVT_F_X_V:
549-
case RISCV::VFWCVT_F_F_V: {
550-
unsigned Log2EEW = IsMODef ? MILog2SEW + 1 : MILog2SEW;
551-
return Log2EEW;
552-
}
549+
case RISCV::VFWCVT_F_F_V:
550+
return IsMODef ? MILog2SEW + 1 : MILog2SEW;
553551

554552
// Def and Op1 uses EEW=2*SEW. Op2 uses EEW=SEW.
555553
case RISCV::VWADDU_WV:
@@ -567,8 +565,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
567565
case RISCV::VFWSUB_WV: {
568566
bool IsOp1 = HasPassthru ? MO.getOperandNo() == 2 : MO.getOperandNo() == 1;
569567
bool TwoTimes = IsMODef || IsOp1;
570-
unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
571-
return Log2EEW;
568+
return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
572569
}
573570

574571
// Vector Integer Extension
@@ -609,8 +606,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
609606
case RISCV::VFNCVT_ROD_F_F_W: {
610607
bool IsOp1 = HasPassthru ? MO.getOperandNo() == 2 : MO.getOperandNo() == 1;
611608
bool TwoTimes = IsOp1;
612-
unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
613-
return Log2EEW;
609+
return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
614610
}
615611

616612
// Vector Mask Instructions
@@ -724,8 +720,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
724720
case RISCV::VFWREDOSUM_VS:
725721
case RISCV::VFWREDUSUM_VS: {
726722
bool TwoTimes = IsMODef || MO.getOperandNo() == 3;
727-
unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
728-
return Log2EEW;
723+
return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
729724
}
730725

731726
default:

0 commit comments

Comments
 (0)