Author: Richard Plangger <r...@pasra.at> Branch: vecopt Changeset: r77758:cd53c1c662a5 Date: 2015-06-02 14:00 +0200 http://bitbucket.org/pypy/pypy/changeset/cd53c1c662a5/
Log: wrong assumption: it can happen that a call that is exception guarded is not immediatley after the call 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 @@ -598,22 +598,32 @@ elif guard_opnum in (rop.GUARD_OVERFLOW, rop.GUARD_NO_OVERFLOW): # previous operation must be an ovf_operation guard_node.setpriority(100) - prev_node = self.nodes[guard_node.getindex()-1] - assert prev_node.getoperation().is_ovf() - prev_node.edge_to(guard_node, None, label='overflow') - elif guard_opnum == rop.GUARD_NOT_FORCED: - # previous op must be one that can raise - guard_node.setpriority(100) - prev_node = self.nodes[guard_node.getindex()-1] - assert prev_node.getoperation().can_raise() - prev_node.edge_to(guard_node, None, label='forced') - elif guard_opnum in (rop.GUARD_NO_EXCEPTION, rop.GUARD_EXCEPTION): + i = guard_node.getindex()-1 + while i >= 0: + node = self.nodes[i] + op = node.getoperation() + if node.is_ovf(): + break + i -= 1 + else: + raise AssertionError("(no)overflow: no overflowing op present") + node.edge_to(guard_node, None, label='overflow') + elif guard_opnum in (rop.GUARD_NO_EXCEPTION, rop.GUARD_EXCEPTION, rop.GUARD_NOT_FORCED): # previous op must be one that can raise or a not forced guard guard_node.setpriority(100) - prev_node = self.nodes[guard_node.getindex()-1] - prev_node.edge_to(guard_node, None, label='exception') - if not prev_node.getoperation().getopnum() == rop.GUARD_NOT_FORCED: - assert prev_node.getoperation().can_raise() + i = guard_node.getindex() - 1 + while i >= 0: + node = self.nodes[i] + op = node.getoperation() + if op.can_raise(): + node.edge_to(guard_node, None, label='exception/notforced') + break + if op.is_guard(): + node.edge_to(guard_node, None, label='exception/notforced') + break + i -= 1 + else: + raise AssertionError("(no)exception/not_forced: not op raises for them") else: pass # not invalidated, early exit, future condition! diff --git a/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py b/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py --- a/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py +++ b/rpython/jit/metainterp/optimizeopt/test/test_vectorize.py @@ -57,6 +57,8 @@ raise NotAVectorizeableLoop() if unroll_factor == -1: unroll_factor = opt.get_unroll_count(ARCH_VEC_REG_SIZE) + print "" + print "unroll factor: ", unroll_factor, opt.smallest_type_bytes opt.analyse_index_calculations() if opt.dependency_graph is not None: self._write_dot_and_convert_to_svg(opt.dependency_graph, "ee" + self.test_name) @@ -831,6 +833,7 @@ def test_packset_vector_operation(self, op, descr, stride): ops = """ [p0,p1,p2,i0] + guard_early_exit() [] i1 = int_add(i0, {stride}) i10 = int_le(i1, 128) guard_true(i10) [] @@ -845,20 +848,14 @@ assert len(vopt.dependency_graph.memory_refs) == 12 assert len(vopt.packset.packs) == 4 - for opindices in [(4,11,18,25),(5,12,19,26), - (6,13,20,27),(7,14,21,28)]: + for opindices in [(5,12,19,26),(6,13,20,27), + (7,14,21,28),(8,15,22,29)]: self.assert_has_pack_with(vopt.packset, opindices) @pytest.mark.parametrize('op,descr,stride', - [('int_add','char',1), - ('int_sub','char',1), - ('int_mul','char',1), - ('float_add','float',8), + [('float_add','float',8), ('float_sub','float',8), ('float_mul','float',8), - ('float_add','singlefloat',4), - ('float_sub','singlefloat',4), - ('float_mul','singlefloat',4), ('int_add','int',8), ('int_sub','int',8), ('int_mul','int',8), @@ -1314,6 +1311,7 @@ def test_abc(self): + py.test.skip() trace =""" """ opt = self.vectorize(self.parse_loop(trace)) @@ -1336,7 +1334,6 @@ """ opt = self.vectorize(self.parse_loop(trace)) self.debug_print_operations(opt.loop) - return class TestLLtype(BaseTestVectorize, LLtypeMixin): pass diff --git a/rpython/jit/metainterp/optimizeopt/vectorize.py b/rpython/jit/metainterp/optimizeopt/vectorize.py --- a/rpython/jit/metainterp/optimizeopt/vectorize.py +++ b/rpython/jit/metainterp/optimizeopt/vectorize.py @@ -214,7 +214,8 @@ if not isinstance(target_guard.getdescr(), ResumeAtLoopHeaderDescr): descr = invent_fail_descr_for_op(copied_op.getopnum(), self) olddescr = copied_op.getdescr() - descr.copy_all_attributes_from(olddescr) + if olddescr: + descr.copy_all_attributes_from(olddescr) copied_op.setdescr(descr) if oi < ee_pos: diff --git a/rpython/jit/metainterp/resoperation.py b/rpython/jit/metainterp/resoperation.py --- a/rpython/jit/metainterp/resoperation.py +++ b/rpython/jit/metainterp/resoperation.py @@ -178,7 +178,7 @@ return rop._RAW_LOAD_FIRST < self.getopnum() < rop._RAW_LOAD_LAST def is_raw_store(self): - return rop._RAW_LOAD_FIRST < self.getopnum() < rop._RAW_LOAD_LAST + return rop._RAW_STORE_FIRST < self.getopnum() < rop._RAW_STORE_LAST def is_comparison(self): return self.is_always_pure() and self.returns_bool_result() _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit