[PATCH] D151406: [Hexagon] Check if register is non-null before calling subregs_inclusive

Sergei Barannikov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 24 21:53:17 PDT 2023


barannikov88 created this revision.
barannikov88 added a reviewer: kparzysz.
Herald added a subscriber: hiraditya.
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/D151406

Files:
  llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp


Index: llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
===================================================================
--- llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
+++ llvm/lib/Target/Hexagon/HexagonFrameLowering.cpp
@@ -307,6 +307,9 @@
           return true;
         if (MO.isReg()) {
           Register R = MO.getReg();
+          // Debug instructions may refer to $noreg.
+          if (!R)
+            continue;
           // Virtual registers will need scavenging, which then may require
           // a stack slot.
           if (R.isVirtual())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151406.525435.patch
Type: text/x-patch
Size: 569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230525/eacbe29a/attachment.bin>


More information about the llvm-commits mailing list