diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-09-22 16:59:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-22 16:59:35 (GMT) |
commit | 7c553991724d8d537f8444db73f016008753d77a (patch) | |
tree | 2dba99305eb1495d37884c9a22c536fb48867ac1 /Python | |
parent | 73ccfa28c5e6ff68de15fdbb1321d4773a688e61 (diff) | |
download | cpython-7c553991724d8d537f8444db73f016008753d77a.zip cpython-7c553991724d8d537f8444db73f016008753d77a.tar.gz cpython-7c553991724d8d537f8444db73f016008753d77a.tar.bz2 |
gh-109719: Fix missing jump target labels when compiler reorders cold/warm blocks (#109734)
Diffstat (limited to 'Python')
-rw-r--r-- | Python/flowgraph.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Python/flowgraph.c b/Python/flowgraph.c index 2df9b48..adfcef3 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -2133,6 +2133,8 @@ push_cold_blocks_to_end(cfg_builder *g) { } RETURN_IF_ERROR(mark_cold(entryblock)); + int next_lbl = get_max_label(g->g_entryblock) + 1; + /* If we have a cold block with fallthrough to a warm block, add */ /* an explicit jump instead of fallthrough */ for (basicblock *b = entryblock; b != NULL; b = b->b_next) { @@ -2141,6 +2143,9 @@ push_cold_blocks_to_end(cfg_builder *g) { if (explicit_jump == NULL) { return ERROR; } + if (!IS_LABEL(b->b_next->b_label)) { + b->b_next->b_label.id = next_lbl++; + } basicblock_addop(explicit_jump, JUMP, b->b_next->b_label.id, NO_LOCATION); explicit_jump->b_cold = 1; explicit_jump->b_next = b->b_next; |