[Python-checkins] bpo-45773: Remove invalid peephole optimizations (GH-31066)

miss-islington webhook-mailer at python.org
Thu Feb 3 10:55:00 EST 2022


https://github.com/python/cpython/commit/ff6948b1286c854ee77dfc0b23b9d828b36873e4
commit: ff6948b1286c854ee77dfc0b23b9d828b36873e4
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-02-03T07:54:51-08:00
summary:

bpo-45773: Remove invalid peephole optimizations (GH-31066)

(cherry picked from commit e0433c1e70254d4d0357a9e14596929a04bdf769)

Co-authored-by: Brandt Bucher <brandt at python.org>

files:
A Misc/NEWS.d/next/Core and Builtins/2022-02-01-14-30-56.bpo-45773.Up77LD.rst
M Python/compile.c

diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-02-01-14-30-56.bpo-45773.Up77LD.rst b/Misc/NEWS.d/next/Core and Builtins/2022-02-01-14-30-56.bpo-45773.Up77LD.rst
new file mode 100644
index 0000000000000..45da5116fc940
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-02-01-14-30-56.bpo-45773.Up77LD.rst	
@@ -0,0 +1 @@
+Remove two invalid "peephole" optimizations from the bytecode compiler.
diff --git a/Python/compile.c b/Python/compile.c
index 3eb34d89cc55f..a7f62bbcbb33e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -7449,7 +7449,6 @@ optimize_basic_block(struct compiler *c, basicblock *bb, PyObject *consts)
                 switch (target->i_opcode) {
                     case JUMP_ABSOLUTE:
                     case JUMP_FORWARD:
-                    case JUMP_IF_FALSE_OR_POP:
                         i -= jump_thread(inst, target, POP_JUMP_IF_FALSE);
                 }
                 break;
@@ -7457,7 +7456,6 @@ optimize_basic_block(struct compiler *c, basicblock *bb, PyObject *consts)
                 switch (target->i_opcode) {
                     case JUMP_ABSOLUTE:
                     case JUMP_FORWARD:
-                    case JUMP_IF_TRUE_OR_POP:
                         i -= jump_thread(inst, target, POP_JUMP_IF_TRUE);
                 }
                 break;



More information about the Python-checkins mailing list