diff --git a/numba_rvsdg/tests/test_byteflow.py b/numba_rvsdg/tests/test_byteflow.py index a92db24..d3b54ea 100644 --- a/numba_rvsdg/tests/test_byteflow.py +++ b/numba_rvsdg/tests/test_byteflow.py @@ -115,7 +115,6 @@ def test_constructor(self): begin=0, end=8, _jump_targets=(), - backedges=(), ) self.assertEqual(block.name, "python_bytecode_block_0") self.assertEqual(block.begin, 0) @@ -134,7 +133,6 @@ def test_is_jump_target(self): _jump_targets=( name_gen.new_block_name(block_names.PYTHON_BYTECODE), ), - backedges=(), ) self.assertEqual(block.jump_targets, ("python_bytecode_block_1",)) self.assertFalse(block.is_exiting) @@ -146,7 +144,6 @@ def test_get_instructions(self): begin=0, end=8, _jump_targets=(), - backedges=(), ) expected = [ Instruction( @@ -243,7 +240,6 @@ def test_build_basic_blocks(self): begin=0, end=10, _jump_targets=(), - backedges=(), ) } ) @@ -267,7 +263,6 @@ def test_from_bytecode(self): begin=0, end=10, _jump_targets=(), - backedges=(), ) } ) diff --git a/numba_rvsdg/tests/test_figures.py b/numba_rvsdg/tests/test_figures.py index 82419f1..249e0f0 100644 --- a/numba_rvsdg/tests/test_figures.py +++ b/numba_rvsdg/tests/test_figures.py @@ -440,7 +440,7 @@ def test_figure_3(self): flow = FlowInfo.from_bytecode(bc) scfg = flow.build_basicblocks() byteflow = ByteFlow(bc=bc, scfg=scfg) - byteflow = byteflow.restructure() + byteflow.restructure() x, _ = SCFG.from_yaml(fig_3_yaml) self.assertSCFGEqual(x, byteflow.scfg) @@ -473,7 +473,11 @@ def test_figure_4(self): flow = FlowInfo.from_bytecode(bc) scfg = flow.build_basicblocks() byteflow = ByteFlow(bc=bc, scfg=scfg) - byteflow = byteflow.restructure() + byteflow.restructure() x, _ = SCFG.from_yaml(fig_4_yaml) self.assertSCFGEqual(x, byteflow.scfg) + + +x = TestBahmannFigures() +x.test_figure_3() diff --git a/numba_rvsdg/tests/test_scfg.py b/numba_rvsdg/tests/test_scfg.py index 3d1d9e5..02149ef 100644 --- a/numba_rvsdg/tests/test_scfg.py +++ b/numba_rvsdg/tests/test_scfg.py @@ -192,17 +192,14 @@ def foo(n): def test_concealed_region_view_iter(self): flow = ByteFlow.from_bytecode(self.foo) - restructured = flow._restructure_loop() + flow._restructure_loop() expected = [ ("python_bytecode_block_0", PythonBytecodeBlock), ("loop_region_0", RegionBlock), ("python_bytecode_block_3", PythonBytecodeBlock), ] received = list( - ( - (k, type(v)) - for k, v in restructured.scfg.concealed_region_view.items() - ) + ((k, type(v)) for k, v in flow.scfg.concealed_region_view.items()) ) self.assertEqual(expected, received) diff --git a/numba_rvsdg/tests/test_simulate.py b/numba_rvsdg/tests/test_simulate.py index 68f8f44..9333bfd 100644 --- a/numba_rvsdg/tests/test_simulate.py +++ b/numba_rvsdg/tests/test_simulate.py @@ -4,7 +4,7 @@ # flow = ByteFlow.from_bytecode(foo) # #pprint(flow.scfg) -# flow = flow.restructure() +# flow.restructure() # #pprint(flow.scfg) # # pprint(rtsflow.scfg) # ByteFlowRenderer().render_byteflow(flow).view() @@ -42,7 +42,7 @@ def foo(x): return c flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() # if case self._run(foo, flow, {"x": 1}) @@ -57,7 +57,7 @@ def foo(x): return c flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() # loop bypass case self._run(foo, flow, {"x": 0}) @@ -76,7 +76,7 @@ def foo(x): return c flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() # loop bypass case self._run(foo, flow, {"x": 0}) @@ -95,7 +95,7 @@ def foo(x): return c flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() # loop bypass case self._run(foo, flow, {"x": 0}) @@ -119,7 +119,7 @@ def foo(x): return c flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() # no loop self._run(foo, flow, {"x": 0}) @@ -143,7 +143,7 @@ def foo(x): return c flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() # loop bypass self._run(foo, flow, {"x": 0}) @@ -159,7 +159,7 @@ def foo(x, y): return (x > 0 and x < 10) or (y > 0 and y < 10) flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() self._run(foo, flow, {"x": 5, "y": 5}) @@ -173,7 +173,7 @@ def foo(s, e): return c flow = ByteFlow.from_bytecode(foo) - flow = flow.restructure() + flow.restructure() # no looping self._run(foo, flow, {"s": 0, "e": 0}) @@ -190,5 +190,5 @@ def foo(s, e): self._run(foo, flow, {"s": 23, "e": 28}) -if __name__ == "__main__": - unittest.main() +# if __name__ == "__main__": +# unittest.main() diff --git a/numba_rvsdg/tests/test_transforms.py b/numba_rvsdg/tests/test_transforms.py index 4b4ce58..e8b384e 100644 --- a/numba_rvsdg/tests/test_transforms.py +++ b/numba_rvsdg/tests/test_transforms.py @@ -756,7 +756,7 @@ def test_backedge_not_exiting(self): '1': ['2', '5'] '2': ['6'] '3': [] - '4': ['1', '3'] + '4': ['3', '1'] '5': ['4'] '6': ['4'] backedges: @@ -810,7 +810,7 @@ def test_multi_back_edge_with_backedge_from_header(self): '1': ['5', '2'] '2': ['6', '7'] '3': [] - '4': ['1', '3'] + '4': ['3', '1'] '5': ['4'] '6': ['4'] '7': ['4'] @@ -876,7 +876,7 @@ def test_double_exit(self): '2': ['3', '6'] '3': ['7', '8'] '4': [] - '5': ['1', '4'] + '5': ['4', '1'] '6': ['5'] '7': ['5'] '8': ['5'] diff --git a/numba_rvsdg/tests/test_utils.py b/numba_rvsdg/tests/test_utils.py index 488a971..556e28c 100644 --- a/numba_rvsdg/tests/test_utils.py +++ b/numba_rvsdg/tests/test_utils.py @@ -65,18 +65,12 @@ def assertSCFGEqual( # Add the jump targets as corresponding nodes in block mapping # dictionary. Since order must be same we can simply add zip # functionality as the correspondence function for nodes - for jt1, jt2 in zip(node.jump_targets, second_node.jump_targets): + for jt1, jt2 in zip(node._jump_targets, second_node._jump_targets): if node.name == exiting: continue block_mapping[jt1] = jt2 stack.append(jt1) - for be1, be2 in zip(node.backedges, second_node.backedges): - if node.name == exiting: - continue - block_mapping[be1] = be2 - stack.append(be1) - def assertYAMLEqual( self, first_yaml: SCFG, second_yaml: SCFG, head_map: dict ):