Skip to content

Commit ecc4c5c

Browse files
fixup! [RISCV][GISel] Select G_SELECT (G_ICMP, A, B)
simplify cond code and fix returns
1 parent 1a57237 commit ecc4c5c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

llvm/lib/Target/RISCV/GISel/RISCVInstructionSelector.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,21 +545,23 @@ void RISCVInstructionSelector::getICMPOperandsForBranch(
545545
MachineInstr *Zero = MIB.buildConstant(
546546
MRI.getType(MaybeConstant->getOperand(0).getReg()), 0);
547547
selectConstant(*Zero, MIB, MRI);
548-
CC = getRISCVCCFromICMP(CmpInst::Predicate::ICMP_SGE);
548+
CC = RISCVCC::COND_GE;
549549
RHS = Zero->getOperand(0).getReg();
550+
return;
550551
}
551-
return;
552+
break;
552553
case CmpInst::Predicate::ICMP_SLT:
553554
// Convert X < 1 to 0 >= X
554555
if (MaybeConstant->getOperand(1).getCImm()->getSExtValue() == 1) {
555556
MachineInstr *Zero = MIB.buildConstant(
556557
MRI.getType(MaybeConstant->getOperand(0).getReg()), 0);
557558
selectConstant(*Zero, MIB, MRI);
558-
CC = getRISCVCCFromICMP(CmpInst::Predicate::ICMP_SGE);
559+
CC = RISCVCC::COND_GE;
559560
RHS = LHS;
560561
LHS = Zero->getOperand(0).getReg();
562+
return;
561563
}
562-
return;
564+
break;
563565
default:
564566
break;
565567
}

0 commit comments

Comments
 (0)