Author: Carl Friedrich Bolz <[email protected]>
Branch: better-storesink
Changeset: r87167:7f1299b60985
Date: 2016-09-12 19:49 +0200
http://bitbucket.org/pypy/pypy/changeset/7f1299b60985/
Log: used the wrong cache in two places while merging
(probably benign, but leads to less good code)
diff --git a/rpython/translator/backendopt/cse.py
b/rpython/translator/backendopt/cse.py
--- a/rpython/translator/backendopt/cse.py
+++ b/rpython/translator/backendopt/cse.py
@@ -111,7 +111,7 @@
for linkindex, (link, cache) in enumerate(tuples):
if linkindex == 0:
continue
- newkey = self._key_with_replacement(
+ newkey = cache._key_with_replacement(
key, 0, link.args[argindex])
otherres = cache.purecache.get(newkey, None)
if otherres is None:
@@ -152,7 +152,7 @@
for linkindex, (link, cache) in enumerate(tuples):
if linkindex == 0:
continue
- otherarg = self._var_rep(link.args[argindex])
+ otherarg = cache._var_rep(link.args[argindex])
newkey = (otherarg, fieldname)
otherres = cache.heapcache.get(newkey, None)
if otherres is None:
diff --git a/rpython/translator/backendopt/test/test_cse.py
b/rpython/translator/backendopt/test/test_cse.py
--- a/rpython/translator/backendopt/test/test_cse.py
+++ b/rpython/translator/backendopt/test/test_cse.py
@@ -401,6 +401,26 @@
return a2.a
self.check(read, [int], getfield=2)
+ def test_cast_pointer_introduce_aliases(self):
+ class A(object):
+ pass
+ class B(A):
+ pass
+ class C(B):
+ pass
+ def f(i):
+ res = 0
+ if i > 10:
+ if i > 20:
+ a = C()
+ a.x = 1
+ else:
+ a = B()
+ a.x = 2
+ # here a is a subclass of B
+ res += a.x
+ return res
+ self.check(f, [int], getfield=0)
def fakevar(name='v'):
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit