mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
gh-93678: apply remove_redundant_jumps in optimize_cfg (GH-96274)
This commit is contained in:
parent
e93d1bda77
commit
894cafd9a5
2 changed files with 36 additions and 14 deletions
|
@ -892,7 +892,8 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
|
|||
self.cfg_optimization_test(insts, expected, consts=list(range(5)))
|
||||
|
||||
def test_conditional_jump_forward_const_condition(self):
|
||||
# The unreachable branch of the jump is removed
|
||||
# The unreachable branch of the jump is removed, the jump
|
||||
# becomes redundant and is replaced by a NOP (for the lineno)
|
||||
|
||||
insts = [
|
||||
('LOAD_CONST', 3, 11),
|
||||
|
@ -903,8 +904,7 @@ class DirectiCfgOptimizerTests(CfgOptimizationTestCase):
|
|||
]
|
||||
expected = [
|
||||
('NOP', None, 11),
|
||||
('JUMP', lbl := self.Label(), 12),
|
||||
lbl,
|
||||
('NOP', None, 12),
|
||||
('LOAD_CONST', '3', 14)
|
||||
]
|
||||
self.cfg_optimization_test(insts, expected, consts=list(range(5)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue