-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
gh-138679: Opcodes which consume no inputs should indicate they produced the val… #138678
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
int net_pushed = num_pushed - num_popped; | ||
assert(net_pushed >= 0); | ||
for (int i = 0; i < net_pushed; i++) { | ||
for (int j = 0; j < net_pushed; j++) { |
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.
You'r adding a test, right?
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.
Test added!
1ab12da
to
31810d5
Compare
Lib/test/test_peepholer.py
Outdated
self.assertNotInBytecode(f, "LOAD_FAST_CHECK") | ||
|
||
def test_import_from_doesnt_clobber_load_fast_borrow(self): | ||
import dis |
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.
Is this needed?
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.
Nope, I'll delete it
31810d5
to
843b24c
Compare
…ue, not an arbitrary local
843b24c
to
b7b35d4
Compare
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 - thanks!
… produced the val… (python#138678) Opcodes which consume no inputs should indicate they produced the value, not an arbitrary local
Summary: Fixing another issue in the borrowed load analysis: python/cpython#138678 Reviewed By: mpage Differential Revision: D81950973 fbshipit-source-id: f6663befbcc36b159cbb03a20354d4452e1e47f8
Summary: There's one thing the AI got wrong - the check to see if we're doing a load super attr isn't quite right There's also an issue in the upstream analysis - the adding of refs for instructions which only produce things is adding a ref associated with the incorrect instruction. It shouldn't be the iteration for the number of pushed values, it should be for the current instruction. This will be fixed upstream with python/cpython#138678 and backported to 3.14 with D81950973. Reviewed By: mpage Differential Revision: D81642077 fbshipit-source-id: 4c8fe7f33fe38fb23c1cbf83074649f272898f71
The load fast borrow analysis is marking the instruction index of opcodes which produce no locals as the delta (so always 0, 1, etc...) and not as the instruction that consumes no opcodes (the outer i).