[pypy-commit] pypy regalloc-playground: make allocation decisions in the LEA case a bit more flexible by freeing the

cfbolz pypy.commits at gmail.com
Fri Sep 8 03:07:37 EDT 2017


Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: regalloc-playground
Changeset: r92349:7a3cd6204340
Date: 2017-09-07 14:32 +0200
http://bitbucket.org/pypy/pypy/changeset/7a3cd6204340/

Log:	make allocation decisions in the LEA case a bit more flexible by
	freeing the argument

diff --git a/rpython/jit/backend/x86/regalloc.py b/rpython/jit/backend/x86/regalloc.py
--- a/rpython/jit/backend/x86/regalloc.py
+++ b/rpython/jit/backend/x86/regalloc.py
@@ -533,7 +533,11 @@
         self.perform(op, [loc, argloc], loc)
 
     def _consider_lea(self, op):
-        loc = self.make_sure_var_in_reg(op.getarg(0))
+        x = op.getarg(0)
+        loc = self.make_sure_var_in_reg(x)
+        # make it possible to have argloc be == loc if x dies
+        # (then LEA will not be used, but that's fine anyway)
+        self.possibly_free_var(x)
         argloc = self.loc(op.getarg(1))
         resloc = self.force_allocate_reg(op)
         self.perform(op, [loc, argloc], resloc)
diff --git a/rpython/jit/backend/x86/test/test_regalloc.py b/rpython/jit/backend/x86/test/test_regalloc.py
--- a/rpython/jit/backend/x86/test/test_regalloc.py
+++ b/rpython/jit/backend/x86/test/test_regalloc.py
@@ -262,6 +262,7 @@
         assert len(self.filter_log_moves()) == 2
 
     def test_jump_hinting(self):
+        self.targettoken._ll_loop_code = 0
         ops = '''
         [i0]
         i1 = int_add(i0, 1)
@@ -280,6 +281,22 @@
         self.interpret(ops, [0], run=False)
         assert len(self.filter_log_moves()) == 1
 
+    def test_jump_hinting_int_add(self):
+        self.targettoken._ll_loop_code = 0
+        ops = '''
+        [i0]
+        i1 = int_add(i0, 1)
+        i3 = int_lt(i1, 20)
+        guard_true(i3) [i1]
+        label(i1, descr=targettoken)
+        i4 = int_add(i1, 1)
+        i6 = int_lt(i4, 20)
+        guard_true(i6) [i4]
+        jump(i4, descr=targettoken)
+        '''
+        self.interpret(ops, [0], run=False)
+        assert len(self.filter_log_moves()) == 1
+
     @pytest.mark.skip("later")
     def test_jump_different_args2(self):
         ops = '''


More information about the pypy-commit mailing list