[New-bugs-announce] [issue4134] Peephole optimization: returning a temp

David Turner report at bugs.python.org
Thu Oct 16 21:54:10 CEST 2008

New submission from David Turner <novalis at novalis.org>:

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

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 <report at bugs.python.org>

More information about the New-bugs-announce mailing list