diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2017-06-11 11:50:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-11 11:50:22 (GMT) |
commit | 36ff451ebae41f09560bff582c95946474d898f8 (patch) | |
tree | 40957c8d378aae1353876d728c07879ae3d28be2 /Python/peephole.c | |
parent | 1efbf92e90ed2edf3f5bb5323340b26f318ff61e (diff) | |
download | cpython-36ff451ebae41f09560bff582c95946474d898f8.zip cpython-36ff451ebae41f09560bff582c95946474d898f8.tar.gz cpython-36ff451ebae41f09560bff582c95946474d898f8.tar.bz2 |
bpo-30501: Make the compiler producing optimized code for condition expressions. (#1851)
Diffstat (limited to 'Python/peephole.c')
-rw-r--r-- | Python/peephole.c | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/Python/peephole.c b/Python/peephole.c index dd8f3e4..1bee710 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -492,16 +492,6 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, in_consts = 0; switch (opcode) { - /* Replace UNARY_NOT POP_JUMP_IF_FALSE - with POP_JUMP_IF_TRUE */ - case UNARY_NOT: - if (nextop != POP_JUMP_IF_FALSE - || !ISBASICBLOCK(blocks, op_start, i + 1)) - break; - fill_nops(codestr, op_start, i + 1); - codestr[nexti] = PACKOPARG(POP_JUMP_IF_TRUE, _Py_OPARG(codestr[nexti])); - break; - /* not a is b --> a is not b not a in b --> a not in b not a is not b --> a is b @@ -626,10 +616,10 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, result of the first test implies the success of a similar test or the failure of the opposite test. Arises in code like: - "if a and b:" - "if a or b:" "a and b or c" "(a and b) and c" + "(a or b) or c" + "(a or b) and c" x:JUMP_IF_FALSE_OR_POP y y:JUMP_IF_FALSE_OR_POP z --> x:JUMP_IF_FALSE_OR_POP z x:JUMP_IF_FALSE_OR_POP y y:JUMP_IF_TRUE_OR_POP z |