From 42d03f393313d8a228a45dad1d0897ea99f5ec89 Mon Sep 17 00:00:00 2001
From: Diego Russo <diego.russo@arm.com>
Date: Mon, 19 May 2025 15:48:55 -0400
Subject: GH-131798: Split CALL_LIST_APPEND into several uops (GH-134240)

---
 Python/optimizer_bytecodes.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

(limited to 'Python/optimizer_bytecodes.c')

diff --git a/Python/optimizer_bytecodes.c b/Python/optimizer_bytecodes.c
index ad25c68e62a..708b436f6e4 100644
--- a/Python/optimizer_bytecodes.c
+++ b/Python/optimizer_bytecodes.c
@@ -1087,6 +1087,13 @@ dummy_func(void) {
         sym_set_null(null);
     }
 
+    op(_GUARD_NOS_NOT_NULL, (nos, unused -- nos, unused)) {
+        if (sym_is_not_null(nos)) {
+            REPLACE_OP(this_instr, _NOP, 0, 0);
+        }
+        sym_set_non_null(nos);
+    }
+
     op(_GUARD_THIRD_NULL, (null, unused, unused -- null, unused, unused)) {
         if (sym_is_null(null)) {
             REPLACE_OP(this_instr, _NOP, 0, 0);
@@ -1135,6 +1142,14 @@ dummy_func(void) {
         sym_set_const(callable, isinstance);
     }
 
+    op(_GUARD_CALLABLE_LIST_APPEND, (callable, unused, unused -- callable, unused, unused)) {
+        PyObject *list_append = _PyInterpreterState_GET()->callable_cache.list_append;
+        if (sym_get_const(ctx, callable) == list_append) {
+            REPLACE_OP(this_instr, _NOP, 0, 0);
+        }
+        sym_set_const(callable, list_append);
+    }
+
 // END BYTECODES //
 
 }
-- 
cgit v1.2.3