diff options
Diffstat (limited to 'Python/compile.c')
-rw-r--r-- | Python/compile.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c index ddeb6663225..cf5c639feab 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -6558,6 +6558,12 @@ ensure_exits_have_lineno(struct compiler *c) if (is_exit_without_lineno(entry)) { entry->b_instr[0].i_lineno = c->u->u_firstlineno; } + /* Eliminate empty blocks */ + for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) { + while (b->b_next && b->b_next->b_iused == 0) { + b->b_next = b->b_next->b_next; + } + } /* Any remaining reachable exit blocks without line number can only be reached by * fall through, and thus can only have a single predecessor */ for (basicblock *b = c->u->u_blocks; b != NULL; b = b->b_list) { |