Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32k
gh-131798: JIT: Narrow the return type of_CONTAINS_OP_SET
to bool#132057
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
instruction after _CONTAINS_OP_SET by settingthe return type to bool.
x = 0 | ||
s = {1, 2, 3} | ||
for _ in range(n): | ||
a = 2 | ||
in_set = a in s | ||
if in_set: | ||
x += 1 |
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.
We might be able to simplify this further, I wasn't sure how much the peepholer would optimize out if I used e.g.2 in s
directly.
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.
2 in s
would have been fine, but this works well too!
85bc489
intopython:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
For context:#130415 (comment)
I did run
make regen-cases
and made sure that the test failed before making the change inoptimizer_bytecodes.c
:)