[Lldb-commits] [lldb] [lldb][bytecode] Compile pick ops using unsigned literal (PR #187376)

Dave Lee via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 18 14:05:50 PDT 2026


https://github.com/kastiglione updated https://github.com/llvm/llvm-project/pull/187376

>From d838b8a85c7193885bafc2544c4d717b91d42ccb Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Wed, 18 Mar 2026 13:53:53 -0700
Subject: [PATCH 1/2] [lldb][bytecode] Compile pick ops using unsigned literal

---
 lldb/examples/python/formatter_bytecode.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lldb/examples/python/formatter_bytecode.py b/lldb/examples/python/formatter_bytecode.py
index e825110356ff6..da114a964f55c 100644
--- a/lldb/examples/python/formatter_bytecode.py
+++ b/lldb/examples/python/formatter_bytecode.py
@@ -1059,14 +1059,14 @@ def visit_Attribute(self, node: ast.Attribute) -> None:
             )
         attr_idx = self._attr_index(node.attr, node)
         pick_idx = self.num_temps + attr_idx
-        self._output(f"{pick_idx} pick")  # "# self.{node.attr}"
+        self._output(f"{pick_idx}u pick")  # "# self.{node.attr}"
         self.num_temps += 1
 
     def visit_Name(self, node: ast.Name) -> None:
         idx = self._stack_index(node)
         if idx is None:
             raise CompilerError(f"unknown local variable: {node.id}", node)
-        self._output(f"{idx} pick")  # "# {node.id}"
+        self._output(f"{idx}u pick")  # "# {node.id}"
         self.num_temps += 1
 
     def _visit_each(self, nodes: Sequence[ast.AST]) -> None:

>From bc0c4934aa4955f9ede41d0a8ed62dab1d934a41 Mon Sep 17 00:00:00 2001
From: Dave Lee <davelee.com at gmail.com>
Date: Wed, 18 Mar 2026 14:05:28 -0700
Subject: [PATCH 2/2] Update tests

---
 .../Inputs/FormatterBytecode/RigidArrayLLDBFormatterC.txt   | 6 +++---
 .../FormatterBytecode/RigidArrayLLDBFormatterSwift.txt      | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterC.txt b/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterC.txt
index dd322077720d7..ee73d1776637d 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterC.txt
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterC.txt
@@ -22,17 +22,17 @@ unsigned char _RigidArray_formatter[] =
     // program size
     "\x27"
     // program
-    "\x21\x00\x03\x22\x08\x5f\x73\x74\x6f\x72\x61\x67\x65\x23\x12\x60\x23\x18\x60\x21\x00\x03\x22\x06\x5f\x63\x6f\x75\x6e\x74\x23\x12\x60\x23\x18\x60\x23\x21\x60"
+    "\x20\x00\x03\x22\x08\x5f\x73\x74\x6f\x72\x61\x67\x65\x23\x12\x60\x23\x18\x60\x20\x00\x03\x22\x06\x5f\x63\x6f\x75\x6e\x74\x23\x12\x60\x23\x18\x60\x23\x21\x60"
     // sig_get_num_children
     "\x02"
     // program size
     "\x04"
     // program
-    "\x21\x02\x03\x13"
+    "\x20\x02\x03\x13"
     // sig_get_child_at_index
     "\x04"
     // program size
     "\x0a"
     // program
-    "\x21\x01\x03\x21\x04\x03\x23\x11\x60\x13"
+    "\x20\x01\x03\x20\x04\x03\x23\x11\x60\x13"
 ;
diff --git a/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterSwift.txt b/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterSwift.txt
index 081979dbc78f1..31a4786bf1bf1 100644
--- a/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterSwift.txt
+++ b/lldb/test/Shell/ScriptInterpreter/Python/Inputs/FormatterBytecode/RigidArrayLLDBFormatterSwift.txt
@@ -20,17 +20,17 @@ let _RigidArray_formatter: (UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UInt8, UIn
     // program size
     0x27,
     // program
-    0x21, 0x00, 0x03, 0x22, 0x08, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x23, 0x12, 0x60, 0x23, 0x18, 0x60, 0x21, 0x00, 0x03, 0x22, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x23, 0x12, 0x60, 0x23, 0x18, 0x60, 0x23, 0x21, 0x60,
+    0x20, 0x00, 0x03, 0x22, 0x08, 0x5f, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x23, 0x12, 0x60, 0x23, 0x18, 0x60, 0x20, 0x00, 0x03, 0x22, 0x06, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x23, 0x12, 0x60, 0x23, 0x18, 0x60, 0x23, 0x21, 0x60,
     // sig_get_num_children
     0x02,
     // program size
     0x04,
     // program
-    0x21, 0x02, 0x03, 0x13,
+    0x20, 0x02, 0x03, 0x13,
     // sig_get_child_at_index
     0x04,
     // program size
     0x0a,
     // program
-    0x21, 0x01, 0x03, 0x21, 0x04, 0x03, 0x23, 0x11, 0x60, 0x13,
+    0x20, 0x01, 0x03, 0x20, 0x04, 0x03, 0x23, 0x11, 0x60, 0x13,
 )



More information about the lldb-commits mailing list