Skip to content
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

GH-131729: Code-gen better liveness analysis #131732

Merged

Conversation

markshannon
Copy link
Member

@markshannon markshannon commented Mar 25, 2025

Also fixes #131695

This PR improves the liveness analysis of the code generator, reducing the number of redundant stores and giving more precise errors.

@markshannon markshannon merged commit 1b8bb1e into python:main Mar 26, 2025
75 checks passed
}
stack_pointer[-1] = b;
Copy link
Member

Choose a reason for hiding this comment

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

@markshannon, this change seems incorrect. b is never written to the stack if we take the first conditional (where value is None and b is True). I suspect there might be other places where reasoning about both arms of a conditional is broken in a similar way.

Copy link
Member Author

Choose a reason for hiding this comment

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

diegorusso pushed a commit to diegorusso/cpython that referenced this pull request Apr 1, 2025
* Rename 'defined' attribute to 'in_local' to more accurately reflect how it is used

* Make death of variables explicit even for array variables.

* Convert in_memory from boolean to stack offset

* Don't apply liveness analysis to optimizer generated code

* Fix RETURN_VALUE in optimizer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The code generated by DECREF_INPUTS() is often inefficient and complex
3 participants