[issue28813] Remove unneeded folded consts after peephole

2017-12-14 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Moving constant folding to the AST level (issue29469) have made this patch outdated. In any case thank you for your patch Adrian. -- resolution: -> out of date stage: patch review -> resolved status: open -> closed superseder: -> AST-level Constant

[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, we intentionally decided not to do this when constant folding was added. The idea was to keep the peephole optimizer simple and to have it do the minimum work necessary to get its job done (optimizing the constants table takes extra time to do but do

[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik
Adrian Wielgosik added the comment: Attached squashed patch. > But moving constant folding from the peephole optimizer to the AST level > (...) would totally eliminate the need in your patch. I'm aware of that and I'm okay with it. I chose an unfortunate moment for implementing this :) -

[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for your patch Adrian. I haven't close look, but at first glance your patch looks correct, and the idea looks great. But moving constant folding from the peephole optimizer to the AST level (issue1346238, issue11549) would totally eliminate the nee

[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik
Changes by Adrian Wielgosik : Added file: http://bugs.python.org/file45662/clean_co_consts.patch ___ Python tracker ___ ___ Python-bugs-list m

[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik
Changes by Adrian Wielgosik : -- keywords: +patch Added file: http://bugs.python.org/file45661/indices_tweak.patch ___ Python tracker ___

[issue28813] Remove unneeded folded consts after peephole

2016-11-27 Thread Adrian Wielgosik
New submission from Adrian Wielgosik: The attached patch adds new logic to peephole compiler to remove constants that are no longer needed after the main peephole pass. For example: def f(): var = 'te' + 'xt' num = -12 num = -6 * 2 return (1, (3, 4), 6)