From 43a969bee37e690211341babd25f978efa60a0e4 Mon Sep 17 00:00:00 2001 From: Tomas Roun Date: Fri, 23 May 2025 01:20:46 +0200 Subject: [PATCH] Improve remove_unneeded_uops --- Python/optimizer_analysis.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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]) {