Skip to content

Conversation

DinoV
Copy link
Contributor

@DinoV DinoV commented Sep 8, 2025

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).

@DinoV DinoV requested a review from mpage September 8, 2025 18:57
@DinoV DinoV changed the title Opcodes which consume no inputs should indicate they produced the val… gh-138679: Opcodes which consume no inputs should indicate they produced the val… Sep 8, 2025
@DinoV DinoV added the skip news label Sep 8, 2025
@DinoV DinoV marked this pull request as ready for review September 8, 2025 19:31
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++) {
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Test added!

@DinoV DinoV force-pushed the no_input_opcodes_instr_index branch 3 times, most recently from 1ab12da to 31810d5 Compare September 8, 2025 20:04
self.assertNotInBytecode(f, "LOAD_FAST_CHECK")

def test_import_from_doesnt_clobber_load_fast_borrow(self):
import dis
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this needed?

Copy link
Contributor Author

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

@DinoV DinoV force-pushed the no_input_opcodes_instr_index branch from 31810d5 to 843b24c Compare September 8, 2025 20:09
@DinoV DinoV force-pushed the no_input_opcodes_instr_index branch from 843b24c to b7b35d4 Compare September 8, 2025 20:18
Copy link
Contributor

@mpage mpage left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

@DinoV DinoV merged commit 1561385 into python:main Sep 8, 2025
47 checks passed
lkollar pushed a commit to lkollar/cpython that referenced this pull request Sep 9, 2025
… produced the val… (python#138678)

Opcodes which consume no inputs should indicate they produced the value, not an arbitrary local
facebook-github-bot pushed a commit to facebookincubator/cinder that referenced this pull request Sep 9, 2025
Summary: Fixing another issue in the borrowed load analysis: python/cpython#138678

Reviewed By: mpage

Differential Revision: D81950973

fbshipit-source-id: f6663befbcc36b159cbb03a20354d4452e1e47f8
facebook-github-bot pushed a commit to facebookincubator/cinderx that referenced this pull request Sep 10, 2025
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
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.

3 participants