bpo-29469: Remove unnecessary peephole optimizer (GH-4863) · python/cpython@eadad1b (original) (raw)

Original file line number Diff line number Diff line change
@@ -345,21 +345,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
345 345 in_consts = 0;
346 346
347 347 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 -
363 348 /* Skip over LOAD_CONST trueconst
364 349 POP_JUMP_IF_FALSE xx. This improves
365 350 "while 1" performance. */