-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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] Add 'bit' primitive type and streamline branching #9606
Conversation
It's only available as an error kind for primitives, and gets translated away during IR building.
I'm going to merge this as soon as I have a green build, since this will get stale very quickly. A review would still be appreciated, and I will respond to review feedback in a separate PR if this PR has already been merged. |
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! Looking forward to seeing its boost on performance
This probably has no direct impact of performance, but this will be useful when working on non-C backends. |
Add the
bit
primitive type that only has two valid values: 0 and 1. The existingboolean primitive type is different as it also supports a third value (for error).
This makes boolean a poor fit for low-level IR operations which never raise an
exception.
Use
bit
as the result type of comparison operations and various primitives.Also simplify the branch operation to not have a special mode for branching on
negative values, since it's needlessly ad hoc. Primitives still support this mode,
but it gets converted away during IR building.
Work on mypyc/mypyc#748.