Skip to content

Commit

Permalink
[LoongArch] Refine the condition to return Match_RequiresAMORdDifferR…
Browse files Browse the repository at this point in the history
…kRj in AsmParser. NFC

This can suppress compilation warning like `enumerated mismatch in conditional expression`.

See:
https://lab.llvm.org/staging/#/builders/236/builds/645/steps/6/logs/warnings__1_
  • Loading branch information
SixWeining committed Jan 11, 2023
1 parent b008f63 commit 43cf2f8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions llvm/lib/Target/LoongArch/AsmParser/LoongArchAsmParser.cpp
Expand Up @@ -1177,9 +1177,8 @@ unsigned LoongArchAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
unsigned Rd = Inst.getOperand(0).getReg();
unsigned Rk = Inst.getOperand(1).getReg();
unsigned Rj = Inst.getOperand(2).getReg();
if (Rd == Rk || Rd == Rj)
return Rd == LoongArch::R0 ? Match_Success
: Match_RequiresAMORdDifferRkRj;
if ((Rd == Rk || Rd == Rj) && Rd != LoongArch::R0)
return Match_RequiresAMORdDifferRkRj;
}
break;
case LoongArch::PseudoLA_PCREL_LARGE:
Expand Down

0 comments on commit 43cf2f8

Please sign in to comment.