diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-09-24 11:51:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-24 11:51:30 (GMT) |
commit | 633bd6e428fa9d2f1c868a3b02b466f69151d1bf (patch) | |
tree | 30863f6b73c429b31ace181d23bd2d6d4f3069ce /Python | |
parent | f6287bd46fce5d9246503ebccac0536f229bd269 (diff) | |
download | cpython-633bd6e428fa9d2f1c868a3b02b466f69151d1bf.zip cpython-633bd6e428fa9d2f1c868a3b02b466f69151d1bf.tar.gz cpython-633bd6e428fa9d2f1c868a3b02b466f69151d1bf.tar.bz2 |
[3.12] gh-109719: Fix missing jump target labels when compiler reorders cold/warm blocks (GH-109734) (#109749)
gh-109719: Fix missing jump target labels when compiler reorders cold/warm blocks (GH-109734)
(cherry picked from commit 7c553991724d8d537f8444db73f016008753d77a)
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
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 0ea3234..d19fe68 100644 --- a/Python/flowgraph.c +++ b/Python/flowgraph.c @@ -1945,6 +1945,8 @@ push_cold_blocks_to_end(cfg_builder *g, int code_flags) { } 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) { @@ -1953,6 +1955,9 @@ push_cold_blocks_to_end(cfg_builder *g, int code_flags) { 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; |