https://github.com/python/cpython/commit/71dea74865a4f0e065e3dfc1acc70f7eee4f659e
commit: 71dea74865a4f0e065e3dfc1acc70f7eee4f659e
branch: main
author: Tomas R. <tomas.ro...@gmail.com>
committer: Fidget-Spinner <kenjin4...@gmail.com>
date: 2025-05-23T20:48:45+08:00
summary:

gh-131798: Small improvements to `remove_unneeded_uops` (GH-134554)

Improve remove_unneeded_uops

files:
M Python/optimizer_analysis.c

diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c
index 851e1efa0497af..6a7df233819b9c 100644
--- a/Python/optimizer_analysis.c
+++ b/Python/optimizer_analysis.c
@@ -558,6 +558,7 @@ const uint16_t op_without_push[MAX_UOP_ID + 1] = {
 const bool op_skip[MAX_UOP_ID + 1] = {
     [_NOP] = true,
     [_CHECK_VALIDITY] = true,
+    [_CHECK_PERIODIC] = true,
     [_SET_IP] = true,
 };
 
@@ -617,7 +618,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int 
buffer_size)
                     while (op_skip[last->opcode]) {
                         last--;
                     }
-                    if (op_without_push[last->opcode]) {
+                    if (op_without_push[last->opcode] && 
op_without_pop[opcode]) {
                         last->opcode = op_without_push[last->opcode];
                         opcode = buffer[pc].opcode = op_without_pop[opcode];
                         if (op_without_pop[last->opcode]) {

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: arch...@mail-archive.com

Reply via email to