-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
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
Conversation
Eclips4
commented
Jan 29, 2025
•
edited by bedevere-app
bot
Loading
edited by bedevere-app
bot
- Issue: Move const folding to the peephole optimizer #126835
Co-authored-by: Irit Katriel <1055913+iritkatriel@users.noreply.github.com>
There was a problem hiding this comment.
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.
Co-authored-by: Yan Yanchii <yyanchiy@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@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. |
… 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>