File tree 1 file changed +4
-3
lines changed
llvm/lib/Target/RISCV/GISel
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -537,11 +537,12 @@ void RISCVInstructionSelector::getICMPOperandsForBranch(
537
537
RHS = MI.getOperand (3 ).getReg ();
538
538
539
539
// Adjust comparisons to use comparison with 0 if possible.
540
- if (auto Constant = matchConstant<int64_t >(RHS, MRI)) {
540
+ int64_t Constant;
541
+ if (mi_match (RHS, MRI, m_ICst (Constant))) {
541
542
switch (ICMPCC) {
542
543
case CmpInst::Predicate::ICMP_SGT:
543
544
// Convert X > -1 to X >= 0
544
- if (* Constant == -1 ) {
545
+ if (Constant == -1 ) {
545
546
MachineInstr *Zero = MIB.buildConstant (MRI.getType (RHS), 0 );
546
547
selectConstant (*Zero, MIB, MRI);
547
548
CC = RISCVCC::COND_GE;
@@ -551,7 +552,7 @@ void RISCVInstructionSelector::getICMPOperandsForBranch(
551
552
break ;
552
553
case CmpInst::Predicate::ICMP_SLT:
553
554
// Convert X < 1 to 0 >= X
554
- if (* Constant == 1 ) {
555
+ if (Constant == 1 ) {
555
556
MachineInstr *Zero = MIB.buildConstant (MRI.getType (RHS), 0 );
556
557
selectConstant (*Zero, MIB, MRI);
557
558
CC = RISCVCC::COND_GE;
You can’t perform that action at this time.
0 commit comments