Skip to content

Commit 4374026

Browse files
committed
[MIPS] Check if register is non-null before calling isSuperOrSubRegisterEq (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
1 parent 0f3efb8 commit 4374026

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3087,6 +3087,7 @@ bool MipsAsmParser::loadAndAddSymbolAddress(const MCExpr *SymExpr,
30873087
MipsMCExpr::create(MipsMCExpr::MEK_HIGHER, SymExpr, getContext());
30883088

30893089
bool RdRegIsRsReg =
3090+
UseSrcReg &&
30903091
getContext().getRegisterInfo()->isSuperOrSubRegisterEq(DstReg, SrcReg);
30913092

30923093
if (canUseATReg() && UseSrcReg && RdRegIsRsReg) {

0 commit comments

Comments
 (0)