[issue44505] loop invariant code motion

2021-06-24 Thread Batuhan Taskaya
Change by Batuhan Taskaya : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pytho

[issue44505] loop invariant code motion

2021-06-24 Thread Batuhan Taskaya
Batuhan Taskaya added the comment: There are multiple issues with doing 'static' loop invariant code motion in python, but the most obvious one is how would you detect if anything in the body is related to the loop or not? The trivial way that the compiled languages do this optimization is g

[issue44505] loop invariant code motion

2021-06-24 Thread zcpara
New submission from zcpara : It is a common scenario to call functions in loop, such as def foo(): for i in range(10): len("abc") Currently, we generate bytecode like this; 2 0 SETUP_LOOP 24 (to 26) 2 LOAD_GLOBAL 0 (range) 4 L