[PATCH] D151288: [MIPS] Check if register is non-null before calling isSuperOrSubRegisterEq (NFCI)

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 23 22:04:17 PDT 2023


barannikov88 created this revision.
barannikov88 added a reviewer: wzssyqa.
Herald added subscribers: atanasyan, jrtc27, hiraditya, arichardson, sdardis.
Herald added a project: All.
barannikov88 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

D151036 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151288

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


Index: llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
===================================================================
--- llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
+++ llvm/lib/Target/Mips/AsmParser/MipsAsmParser.cpp
@@ -3087,6 +3087,7 @@
         MipsMCExpr::create(MipsMCExpr::MEK_HIGHER, SymExpr, getContext());
 
     bool RdRegIsRsReg =
+        SrcReg &&
         getContext().getRegisterInfo()->isSuperOrSubRegisterEq(DstReg, SrcReg);
 
     if (canUseATReg() && UseSrcReg && RdRegIsRsReg) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151288.525002.patch
Type: text/x-patch
Size: 512 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230524/b840b1fe/attachment.bin>


More information about the llvm-commits mailing list