]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-138250: load fast optimization should fall through to empty blocks (#138249)
authorDino Viehland <dinoviehland@meta.com>
Fri, 29 Aug 2025 18:49:35 +0000 (11:49 -0700)
committerGitHub <noreply@github.com>
Fri, 29 Aug 2025 18:49:35 +0000 (11:49 -0700)
load fast optimization should fall through to empty blocks

Python/flowgraph.c

index f8a4fa60f223df5cc7133acca4655ee8abcc0f7a..3a29845db9f7f85bbf4bd3fa7aa9c56950db5f9f 100644 (file)
@@ -2993,11 +2993,8 @@ optimize_load_fast(cfg_builder *g)
         }
 
         // Push fallthrough block
-        cfg_instr *term = basicblock_last_instr(block);
-        if (term != NULL && block->b_next != NULL &&
-            !(IS_UNCONDITIONAL_JUMP_OPCODE(term->i_opcode) ||
-              IS_SCOPE_EXIT_OPCODE(term->i_opcode))) {
-            assert(BB_HAS_FALLTHROUGH(block));
+        if (BB_HAS_FALLTHROUGH(block)) {
+            assert(block->b_next != NULL);
             load_fast_push_block(&sp, block->b_next, refs.size);
         }