-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
[mypyc] Implement lowering pass and add primitives for int (in)equality #17027
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pre-existing tests are still failing.
JukkaL
changed the title
[mypyc] Implement lowering pass and add high-level primitives for int (in)equality
[mypyc] Implement lowering pass and add primitives for int (in)equality
Mar 14, 2024
for more information, see https://pre-commit.ci
jhance
approved these changes
Mar 14, 2024
It's pointless, plus the IR is incomplete and so code gen will likely fail.
This seems to expose a pre-existing bug in reference counting transform. |
This was actually a regression in this PR. We hit a limitation of the reference counting transform (not a bug as such). |
JukkaL
added a commit
that referenced
this pull request
Mar 19, 2024
…17040) Support lowering of tagged integer `<`, `<=`, `>` and `>=` operations. Previously we had separate code paths for integer comparisons in values vs conditions. Unify these and remove the duplicate code path. The different code paths produced subtly different code, but now they are identical. The generated code is now sometimes slightly more verbose in the slow path (big integer). I may look into simplifying it in a follow-up PR. This also makes the output of many irbuild test cases significantly more compact. Follow-up to #17027. Work on mypyc/mypyc#854.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a new
PrimitiveOp
op which can be transformed into lower-level ops in a lowering pass after reference counting op insertion pass.Higher-level ops in IR make it easier to implement various optimizations, and the output of irbuild test cases will be more compact and readable.
Implement the lowering pass. Currently it's pretty minimal, and I will add additional primitives and the direct transformation of various primitives to
CallC
ops in follow-up PRs. Currently primitives that map to C calls generateCallC
ops in the main irbuild pass, but the long-term goal is to only/mostly generatePrimitiveOp
s instead ofCallC
ops during the main irbuild pass.Also implement primitives for tagged integer equality and inequality as examples.
Lowering of primitives is implemented using decorated handler functions in
mypyc.lower
that are found based on the name of the primitive. The name has no other significance, though it's also used in pretty-printed IR output.Work on mypyc/mypyc#854. The issue describes the motivation in more detail.