diff options
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_peepholer.py | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Lib/test/test_peepholer.py b/Lib/test/test_peepholer.py index 82b0b50..fba41f0 100644 --- a/Lib/test/test_peepholer.py +++ b/Lib/test/test_peepholer.py @@ -991,6 +991,7 @@ class DirectCfgOptimizerTests(CfgOptimizationTestCase): ('LOAD_NAME', 1, 11), ('POP_JUMP_IF_TRUE', lbl := self.Label(), 12), ('LOAD_CONST', 2, 13), + ('RETURN_VALUE', 13), lbl, ('LOAD_CONST', 3, 14), ('RETURN_VALUE', 14), @@ -998,7 +999,7 @@ class DirectCfgOptimizerTests(CfgOptimizationTestCase): expected_insts = [ ('LOAD_NAME', 1, 11), ('POP_JUMP_IF_TRUE', lbl := self.Label(), 12), - ('LOAD_CONST', 1, 13), + ('RETURN_CONST', 1, 13), lbl, ('RETURN_CONST', 2, 14), ] @@ -1072,6 +1073,7 @@ class DirectCfgOptimizerTests(CfgOptimizationTestCase): ('STORE_FAST', 1, 4), ('STORE_FAST', 1, 4), ('POP_TOP', 0, 4), + ('LOAD_CONST', 0, 5), ('RETURN_VALUE', 5) ] expected_insts = [ @@ -1080,7 +1082,7 @@ class DirectCfgOptimizerTests(CfgOptimizationTestCase): ('NOP', 0, 3), ('STORE_FAST', 1, 4), ('POP_TOP', 0, 4), - ('RETURN_VALUE', 5) + ('RETURN_CONST', 0) ] self.cfg_optimization_test(insts, expected_insts, consts=list(range(3)), nlocals=1) @@ -1092,6 +1094,7 @@ class DirectCfgOptimizerTests(CfgOptimizationTestCase): ('STORE_FAST', 1, 4), ('STORE_FAST', 1, 4), ('STORE_FAST', 1, 4), + ('LOAD_CONST', 0, 5), ('RETURN_VALUE', 5) ] expected_insts = [ @@ -1100,7 +1103,7 @@ class DirectCfgOptimizerTests(CfgOptimizationTestCase): ('NOP', 0, 3), ('POP_TOP', 0, 4), ('STORE_FAST', 1, 4), - ('RETURN_VALUE', 5) + ('RETURN_CONST', 0, 5) ] self.cfg_optimization_test(insts, expected_insts, consts=list(range(3)), nlocals=1) @@ -1112,9 +1115,19 @@ class DirectCfgOptimizerTests(CfgOptimizationTestCase): ('STORE_FAST', 1, 4), ('STORE_FAST', 1, 5), ('STORE_FAST', 1, 6), + ('LOAD_CONST', 0, 5), ('RETURN_VALUE', 5) ] - self.cfg_optimization_test(insts, insts, consts=list(range(3)), nlocals=1) + expected_insts = [ + ('LOAD_CONST', 0, 1), + ('LOAD_CONST', 1, 2), + ('LOAD_CONST', 2, 3), + ('STORE_FAST', 1, 4), + ('STORE_FAST', 1, 5), + ('STORE_FAST', 1, 6), + ('RETURN_CONST', 0, 5) + ] + self.cfg_optimization_test(insts, expected_insts, consts=list(range(3)), nlocals=1) if __name__ == "__main__": |