Skip to content

Commit eadad1b

Browse files
authored
bpo-29469: Remove unnecessary peephole optimizer (GH-4863)
Conversions like `not a is b -> a is not b` are implemented in AST optimizer in previous commit (7ea143a). So this commit removes them from peephole optimizer.
1 parent 374c6e1 commit eadad1b

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

‎Python/peephole.c‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -345,21 +345,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
345345
in_consts = 0;
346346

347347
switch (opcode) {
348-
/* not a is b --> a is not b
349-
not a in b --> a not in b
350-
not a is not b --> a is b
351-
not a not in b --> a in b
352-
*/
353-
case COMPARE_OP:
354-
j = get_arg(codestr, i);
355-
if (j < 6 || j > 9 ||
356-
nextop != UNARY_NOT ||
357-
!ISBASICBLOCK(blocks, op_start, i + 1))
358-
break;
359-
codestr[i] = PACKOPARG(opcode, j^1);
360-
fill_nops(codestr, i + 1, nexti + 1);
361-
break;
362-
363348
/* Skip over LOAD_CONST trueconst
364349
POP_JUMP_IF_FALSE xx. This improves
365350
"while 1" performance. */

0 commit comments

Comments
 (0)