[pypy-commit] pypy vecopt-merge: e.g. [i for i, x in enumerate(...) if cond] will consume an index i even if the condition is not met

plan_rich noreply at buildbot.pypy.org
Tue Oct 13 12:08:36 CEST 2015


Author: Richard Plangger <planrichi at gmail.com>
Branch: vecopt-merge
Changeset: r80156:f8d1a700ef62
Date: 2015-10-13 12:05 +0200
http://bitbucket.org/pypy/pypy/changeset/f8d1a700ef62/

Log:	e.g. [i for i,x in enumerate(...) if cond] will consume an index i
	even if the condition is not met

diff --git a/rpython/jit/metainterp/optimizeopt/dependency.py b/rpython/jit/metainterp/optimizeopt/dependency.py
--- a/rpython/jit/metainterp/optimizeopt/dependency.py
+++ b/rpython/jit/metainterp/optimizeopt/dependency.py
@@ -140,6 +140,7 @@
 
     def getoperation(self):
         return self.op
+
     def getindex(self):
         return self.opidx
 
@@ -543,7 +544,9 @@
     def __init__(self, loop):
         self.loop = loop
         self.label = Node(loop.label, 0)
-        self.nodes = [ Node(op,i+1) for i,op in enumerate(loop.operations) if not op.is_jit_debug() ]
+        self.nodes = [ Node(op,0) for op in loop.operations if not op.is_jit_debug() ]
+        for i,node in enumerate(self.nodes):
+            node.opidx = i+1
         self.inodes = [] # imaginary nodes
         self.jump = Node(loop.jump, len(self.nodes)+1)
         self.invariant_vars = {}


More information about the pypy-commit mailing list