Skip to content

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

Merged
Eclips4 merged 16 commits into
python:mainfrom
Eclips4:move-codegen-optimization
Feb 1, 2025
Merged

gh-126835: Move optimization of constant sequence creation from codegen to CFG#129426
Eclips4 merged 16 commits into
python:mainfrom
Eclips4:move-codegen-optimization

Conversation

@Eclips4

@Eclips4Eclips4 commented Jan 29, 2025

Copy link
Copy Markdown
Member

@Eclips4
Eclips4 marked this pull request as draft January 29, 2025 09:22
@Eclips4
Eclips4 marked this pull request as ready for review January 29, 2025 10:45
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c

@WolframAlphWolframAlph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions, suggestions and nitpicks.

Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c Outdated
Comment threadPython/flowgraph.c
Eclips4and others added 2 commits January 31, 2025 18:28
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>

@WolframAlphWolframAlph left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Comment threadPython/flowgraph.c Outdated

@iritkatrieliritkatriel left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Eclips4
Eclips4 enabled auto-merge (squash) February 1, 2025 10:31
@Eclips4
Eclips4 merged commit 7d0521d into python:mainFeb 1, 2025
@Eclips4
Eclips4 deleted the move-codegen-optimization branch February 4, 2025 17:43
@WolframAlph

Copy link
Copy Markdown
Contributor

@Eclips4 , all tests pass when I disable this optimization. Is it intended? Shouldn't we have some tests for this?

@Eclips4

Copy link
Copy Markdown
MemberAuthor

@Eclips4 , all tests pass when I disable this optimization. Is it intended? Shouldn't we have some tests for this?

Yes, it's expected. There are existing tests that test this. You can see one of them in this PR, which I needed to tweak.

srinivasreddy pushed a commit to srinivasreddy/cpython that referenced this pull request Feb 7, 2025
… codegen to CFG (python#129426)
Codegen phase has an optimization that transforms
```
LOAD_CONST x
LOAD_CONST y
LOAD_CONXT z
BUILD_LIST/BUILD_SET (3)
```
->
```
BUILD_LIST/BUILD_SET (0)
LOAD_CONST (x, y, z)
LIST_EXTEND/SET_UPDATE 1
```
This optimization has now been moved to CFG phase to make python#128802 work.
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@Eclips4@WolframAlph@iritkatriel