Skip to content

[3.12] gh-109889: comment out assertion indicating a failed optimization of a redundant NOP #109899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Python/flowgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ _PyCfgBuilder_Addop(cfg_builder *g, int opcode, int oparg, location loc)
#ifndef NDEBUG
static int remove_redundant_nops(basicblock *bb);

/*
static bool
no_redundant_nops(cfg_builder *g) {
for (basicblock *b = g->g_entryblock; b != NULL; b = b->b_next) {
Expand All @@ -375,6 +376,7 @@ no_redundant_nops(cfg_builder *g) {
}
return true;
}
*/

static bool
no_empty_basic_blocks(cfg_builder *g) {
Expand Down Expand Up @@ -1595,7 +1597,11 @@ optimize_cfg(cfg_builder *g, PyObject *consts, PyObject *const_cache)
remove_redundant_nops(b);
}
eliminate_empty_basic_blocks(g);
assert(no_redundant_nops(g));
/* This assertion fails in an edge case (See gh-109889).
* Remove it for the release (it's just one more NOP in the
* bytecode for unlikely code).
*/
// assert(no_redundant_nops(g));
RETURN_IF_ERROR(remove_redundant_jumps(g));
return SUCCESS;
}
Expand Down