From: Tomas R. Date: Fri, 23 May 2025 12:48:45 +0000 (-0400) Subject: gh-131798: Small improvements to `remove_unneeded_uops` (GH-134554) X-Git-Tag: v3.15.0a1~1549 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=71dea74865a4f0e065e3dfc1acc70f7eee4f659e;p=thirdparty%2FPython%2Fcpython.git gh-131798: Small improvements to `remove_unneeded_uops` (GH-134554) Improve remove_unneeded_uops --- diff --git a/Python/optimizer_analysis.c b/Python/optimizer_analysis.c index 851e1efa0497..6a7df233819b 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]) {