New submission from David Turner <[EMAIL PROTECTED]>:

This patch adds an optimization to the peephole optimizer for the common
case of:

def func(...):
   ...
   retval = ...
   return retval

Before the patch, the compiler would generate
STORE_FAST 3
LOAD_FAST 3
RETURN_VALUE

The store and load are pointless, as the local 3 (or whatever) is never
used again.  This patch makes the peephole optimizer optimize them out.

----------
components: None
files: peephole-return-temp.diff
keywords: patch
messages: 74853
nosy: novalis_dt
severity: normal
status: open
title: Peephole optimization: returning a temp
versions: Python 2.7
Added file: http://bugs.python.org/file11811/peephole-return-temp.diff

_______________________________________
Python tracker <[EMAIL PROTECTED]>
<http://bugs.python.org/issue4134>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to