This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Better dead code elimination for the AST compiler
Type: Stage:
Components: Interpreter Core Versions: Python 2.5
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: brett.cannon, georg.brandl, nnorwitz, sdahlbac, titanstar
Priority: normal Keywords: patch

Created on 2005-11-02 18:21 by titanstar, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
if0.diff georg.brandl, 2006-05-26 11:34 new patch
Messages (7)
msg48946 - (view) Author: Rune Holm (titanstar) Date: 2005-11-02 18:21
Here's a patch that adds dead code elimination for if
0: style statements, and improves the current dead code
elimination for while statements by not performing
elimination if the function is a generator.  If the
last yield statement from a generator is removed, the
generator is turned into a regular function, which
changes the semantics of the function.
msg48947 - (view) Author: Simon Dahlbacka (sdahlbac) Date: 2005-11-06 19:08
Logged In: YES 
user_id=750513

the actual patch is missing..
msg48948 - (view) Author: Rune Holm (titanstar) Date: 2005-11-06 20:41
Logged In: YES 
user_id=858364

Sorry, I'm new to the sourceforge patch tracker. The patch should be 
attached now.
msg48949 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-05-26 11:34
Logged In: YES 
user_id=849994

Attaching new patch which does elimination for if 0, if 1
and if __debug__ correctly (visiting else clauses!) and
correctly recognizes functions mixing "return x" and "yield".
msg48950 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2006-06-03 23:51
Logged In: YES 
user_id=357491

Replied on python-dev, but for thoroughness, the patch looks
fine from looking at the patch file itself.  Apply the
'return' detection on its own, though, for better tracking
of changes and easier rollback if something does go bad.
msg48951 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2006-06-04 06:07
Logged In: YES 
user_id=33168

It would be nice to make a #define for the error message so
they don't get out of sync.  I wouldn't mind seeing the
variable name spelled out, ste_returns_value or something
like that.

I didn't look closely at the line numbers and verify the
changes were correct.
msg48952 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-06-04 21:57
Logged In: YES 
user_id=849994

Added your suggestions and committed as rev. 46650.
History
Date User Action Args
2022-04-11 14:56:13adminsetgithub: 42544
2005-11-02 18:21:32titanstarcreate