Skip to content

Commit 41e4018

Browse files
authored
[RISCV][VLOPT] Simplify code by removing extra temporary variables. NFC (#122333)
Just do the conditional operator in the return statement.
1 parent b11fe33 commit 41e4018

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
@@ -550,10 +550,8 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
550550
case RISCV::VFWCVT_RTZ_X_F_V:
551551
case RISCV::VFWCVT_F_XU_V:
552552
case RISCV::VFWCVT_F_X_V:
553-
case RISCV::VFWCVT_F_F_V: {
554-
unsigned Log2EEW = IsMODef ? MILog2SEW + 1 : MILog2SEW;
555-
return Log2EEW;
556-
}
553+
case RISCV::VFWCVT_F_F_V:
554+
return IsMODef ? MILog2SEW + 1 : MILog2SEW;
557555

558556
// Def and Op1 uses EEW=2*SEW. Op2 uses EEW=SEW.
559557
case RISCV::VWADDU_WV:
@@ -571,8 +569,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
571569
case RISCV::VFWSUB_WV: {
572570
bool IsOp1 = HasPassthru ? MO.getOperandNo() == 2 : MO.getOperandNo() == 1;
573571
bool TwoTimes = IsMODef || IsOp1;
574-
unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
575-
return Log2EEW;
572+
return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
576573
}
577574

578575
// Vector Integer Extension
@@ -613,8 +610,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
613610
case RISCV::VFNCVT_ROD_F_F_W: {
614611
bool IsOp1 = HasPassthru ? MO.getOperandNo() == 2 : MO.getOperandNo() == 1;
615612
bool TwoTimes = IsOp1;
616-
unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
617-
return Log2EEW;
613+
return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
618614
}
619615

620616
// Vector Mask Instructions
@@ -728,8 +724,7 @@ getOperandLog2EEW(const MachineOperand &MO, const MachineRegisterInfo *MRI) {
728724
case RISCV::VFWREDOSUM_VS:
729725
case RISCV::VFWREDUSUM_VS: {
730726
bool TwoTimes = IsMODef || MO.getOperandNo() == 3;
731-
unsigned Log2EEW = TwoTimes ? MILog2SEW + 1 : MILog2SEW;
732-
return Log2EEW;
727+
return TwoTimes ? MILog2SEW + 1 : MILog2SEW;
733728
}
734729

735730
default:

0 commit comments

Comments
 (0)