[PATCH] D138341: [TableGen] Fix SubRegIndex size computation for concatenated subregs of unknown size

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 20 11:52:44 PST 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG294fdd99039e: [TableGen] Fix SubRegIndex size computation for concatenated subregs of unknown… (authored by bjope).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138341/new/

https://reviews.llvm.org/D138341

Files:
  llvm/test/TableGen/ConcatenatedSubregs.td
  llvm/utils/TableGen/CodeGenRegisters.cpp


Index: llvm/utils/TableGen/CodeGenRegisters.cpp
===================================================================
--- llvm/utils/TableGen/CodeGenRegisters.cpp
+++ llvm/utils/TableGen/CodeGenRegisters.cpp
@@ -1369,11 +1369,15 @@
   unsigned Size = Parts.front()->Size;
   unsigned LastOffset = Parts.front()->Offset;
   unsigned LastSize = Parts.front()->Size;
+  unsigned UnknownSize = (uint16_t)-1;
   for (unsigned i = 1, e = Parts.size(); i != e; ++i) {
     Name += '_';
     Name += Parts[i]->getName();
-    Size += Parts[i]->Size;
-    if (Parts[i]->Offset != (LastOffset + LastSize))
+    if (Size == UnknownSize || Parts[i]->Size == UnknownSize)
+      Size = UnknownSize;
+    else
+      Size += Parts[i]->Size;
+    if (LastSize == UnknownSize || Parts[i]->Offset != (LastOffset + LastSize))
       isContinuous = false;
     LastOffset = Parts[i]->Offset;
     LastSize = Parts[i]->Size;
Index: llvm/test/TableGen/ConcatenatedSubregs.td
===================================================================
--- llvm/test/TableGen/ConcatenatedSubregs.td
+++ llvm/test/TableGen/ConcatenatedSubregs.td
@@ -96,12 +96,10 @@
 // CHECK-LABEL: SubRegIndex sub2:
 // Check inferred indexes:
 // CHECK-LABEL: SubRegIndex ssub1_ssub2:
-// FIXME: Size should be unknown (65535).
-// CHECK:         Offset, Size: 16, 15
+// CHECK:         Offset, Size: 16, 65535
 // CHECK-LABEL: SubRegIndex ssub3_ssub4:
 // CHECK-LABEL: SubRegIndex ssub0_ssub1_ssub2_ssub3:
-// FIXME: Size should be unknown (65535).
-// CHECK:         Offset, Size: 65535, 30
+// CHECK:         Offset, Size: 65535, 65535
 // CHECK-LABEL: SubRegIndex ssub1_ssub2_ssub3_ssub4:
 
 // Check that all subregs are generated on some examples


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138341.476768.patch
Type: text/x-patch
Size: 1705 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221120/2d8d33da/attachment.bin>


More information about the llvm-commits mailing list