8000 gh-126835: Move optimization of constant sequence creation from codegen to CFG by Eclips4 · Pull Request #129426 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-126835: Move optimization of constant sequence creation from codegen to CFG #129426

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 16 commits into from
Feb 1, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Remove list arg
  • Loading branch information
Eclips4 committed Jan 29, 2025
commit 312fd30fbfbda443f50dd6d34660c519c6d6730c
7 changes: 4 additions & 3 deletions 8000 Python/flowgraph.c
Original file line number Diff line number Diff line change
Expand Up @@ -1400,11 +1400,12 @@ static int
optimize_const_sequence(PyObject *const_cache,
cfg_instr* inst,
int n, PyObject *consts,
int list, int build, int extend)
int build, int extend)
{
assert(PyDict_CheckExact(const_cache));
assert(PyList_CheckExact(consts));
assert(inst[n].i_oparg == n);
int list = build == BUILD_LIST;
if (list) {
assert(inst[n].i_opcode == BUILD_LIST);
}
Expand Down Expand Up @@ -1817,14 +1818,14 @@ optimize_basic_block(PyObject *const_cache, basicblock *bb, PyObject *consts)
break;
case BUILD_LIST:
if (i >= oparg) {
if (optimize_const_sequence(const_cache, inst-oparg, oparg, consts, 1, BUILD_LIST, LIST_EXTEND)) {
if (optimize_const_sequence(const_cache, inst-oparg, oparg, consts, BUILD_LIST, LIST_EXTEND)) {
goto error;
}
}
break;
case BUILD_SET:
if (i >= oparg) {
if (optimize_const_sequence(const_cache, inst-oparg, oparg, consts, 0, BUILD_SET, SET_UPDATE)) {
if (optimize_const_sequence(const_cache, inst-oparg, oparg, consts, BUILD_SET, SET_UPDATE)) {
goto error;
}
}
Expand Down
Loading
0