[llvm] [RISCV][GISel] Simplify selectSelect. NFC (PR #70846)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 31 11:13:28 PDT 2023
================
@@ -776,27 +776,25 @@ static void getICMPOperandsForBranch(MachineInstr &MI, MachineIRBuilder &MIB,
bool RISCVInstructionSelector::selectSelect(MachineInstr &MI,
MachineIRBuilder &MIB,
MachineRegisterInfo &MRI) const {
- assert(MI.getOpcode() == TargetOpcode::G_SELECT);
+ auto &SelectMI = cast<GSelect>(MI);
// If MI is a G_SELECT(G_ICMP(tst, A, B), C, D) then we can use (A, B, tst)
// as the (LHS, RHS, CC) of the Select_GPR_Using_CC_GPR.
- Register MIOp1Reg = MI.getOperand(1).getReg();
- bool Op1IsICMP = mi_match(MIOp1Reg, MRI, m_GICmp(m_Pred(), m_Reg(), m_Reg()));
- RISCVCC::CondCode CC;
- Register LHS, RHS;
+ Register LHS = SelectMI.getCondReg();
+ Register RHS = RISCV::X0;
+ RISCVCC::CondCode CC = RISCVCC::COND_NE;
+
+ bool Op1IsICMP = mi_match(LHS, MRI, m_GICmp(m_Pred(), m_Reg(), m_Reg()));
if (Op1IsICMP)
----------------
mshockwave wrote:
I think Op1IsICMP can be merged into the if statement (without making the line too long)
https://github.com/llvm/llvm-project/pull/70846
More information about the llvm-commits
mailing list