Skip to content

Commit c05eaf1

Browse files
committed
update order
1 parent f15d1c0 commit c05eaf1

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

Python/flowgraph.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2630,9 +2630,15 @@ remove_redundant_nops_and_jumps(cfg_builder *g)
26302630
Code trasnformations that reduce code size initially fill the gaps with
26312631
NOPs. Later those NOPs are removed.
26322632
*/
2633+
2634+
static int
2635+
add_checks_for_loads_of_uninitialized_variables(basicblock *entryblock,
2636+
int nlocals,
2637+
int nparams);
2638+
26332639
static int
26342640
optimize_cfg(cfg_builder *g, PyObject *consts, PyObject *const_cache,
2635-
_Py_hashtable_t *consts_index, int firstlineno)
2641+
_Py_hashtable_t *consts_index, int firstlineno, int nlocals, int nparams)
26362642
{
26372643
assert(PyDict_CheckExact(const_cache));
26382644
RETURN_IF_ERROR(check_cfg(g));
@@ -2643,6 +2649,9 @@ optimize_cfg(cfg_builder *g, PyObject *consts, PyObject *const_cache,
26432649
for (basicblock *b = g->g_entryblock; b != NULL; b = b->b_next) {
26442650
RETURN_IF_ERROR(optimize_basic_block(const_cache, b, consts, consts_index));
26452651
}
2652+
RETURN_IF_ERROR(
2653+
add_checks_for_loads_of_uninitialized_variables(
2654+
g->g_entryblock, nlocals, nparams));
26462655
RETURN_IF_ERROR(remove_redundant_nops_and_pairs(g->g_entryblock));
26472656
RETURN_IF_ERROR(remove_unreachable(g->g_entryblock));
26482657
RETURN_IF_ERROR(remove_redundant_nops_and_jumps(g));
@@ -3784,16 +3793,14 @@ _PyCfg_OptimizeCodeUnit(cfg_builder *g, PyObject *consts, PyObject *const_cache,
37843793
return ERROR;
37853794
}
37863795
}
3787-
int ret = optimize_cfg(g, consts, const_cache, consts_index, firstlineno);
3796+
3797+
int ret = optimize_cfg(g, consts, const_cache, consts_index, firstlineno, nlocals, nparams);
37883798

37893799
_Py_hashtable_destroy(consts_index);
37903800

37913801
RETURN_IF_ERROR(ret);
37923802

37933803
RETURN_IF_ERROR(remove_unused_consts(g->g_entryblock, consts));
3794-
RETURN_IF_ERROR(
3795-
add_checks_for_loads_of_uninitialized_variables(
3796-
g->g_entryblock, nlocals, nparams));
37973804
RETURN_IF_ERROR(insert_superinstructions(g));
37983805

37993806
RETURN_IF_ERROR(push_cold_blocks_to_end(g));

0 commit comments

Comments
 (0)