Skip to content

Commit

Permalink
[MIPS] Check if register is non-null before calling isSuperOrSubRegis…
Browse files Browse the repository at this point in the history
…terEq (NFCI)

D151036 adds an assertions that prohibits iterating over sub- and
super-registers of a null register. This is already the case when
iterating over register units of a null register, and worked by
accident for sub- and super-registers.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D151288
  • Loading branch information
s-barannikov committed May 25, 2023
1 parent 0f3efb8 commit 4374026
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
Expand Up @@ -3087,6 +3087,7 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
MipsMCExpr::create(MipsMCExpr::MEK_HIGHER, SymExpr, getContext());

bool RdRegIsRsReg =
UseSrcReg &&
getContext().getRegisterInfo()->isSuperOrSubRegisterEq(DstReg, SrcReg);

if (canUseATReg() && UseSrcReg && RdRegIsRsReg) {
Expand Down

0 comments on commit 4374026

Please sign in to comment.