[issue37500] 3.8.0b2 no longer optimizes away "if 0:" ?
Tim Peters
report at bugs.python.org
Fri Jul 5 20:05:56 EDT 2019
Tim Peters <tim at python.org> added the comment:
> Using jumps is not removing the optimization
> entirely, is just a weaker and more incomplete
> way of doing the same.
Sorry, I'm afraid I have no idea what that means. The generated code before and after was wildly different, as shown in Ned's original report here. In what possible sense was his "if 0:" being "optimized" if it generated code to load 0 onto the stack, then POP_JUMP_IF_FALSE, and then jumped over all the code generated for the dead block?
The generated code after is nearly identical if I replace his "if 0:" with "if x:" (which the compiler takes to mean a global or builtin about whose truthiness it knows nothing at all). Indeed, the only difference in the byte code is that instead of doing a LOAD_CONST to load 0, it does a LOAD_GLOBAL to load x.
So, to my eyes, absolutely nothing of the optimization remained. At least not in the example Ned posted here.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37500>
_______________________________________
More information about the Python-bugs-list
mailing list