8000 gh-106581: Fix two bugs in the code generator's copy optimization by gvanrossum · Pull Request #108380 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-106581: Fix two bugs in the code generator's copy optimization #108380

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

Merged
merged 5 commits into from
Aug 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix mypy
  • Loading branch information
gvanrossum committed Aug 24, 2023
commit 1ca845aae0057b138b8928d75d1afed8a4aa0ea3
5 changes: 3 additions & 2 deletions Tools/cases_generator/stacking.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,15 @@ def __init__(
# Fix up patterns of copies through UNUSED,
# e.g. cp(a, UNUSED) + cp(UNUSED, b) -> cp(a, b).
if any(copy.src.effect.name == UNUSED for copy in self.copies):
pred = self
while pred := pred.pred:
pred = self.pred
while pred is not None:
for copy in self.copies:
if copy.src.effect.name == UNUSED:
for pred_copy in pred.copies:
if pred_copy.dst == copy.src:
copy.src = pred_copy.src
break
pred = pred.pred

def adjust_deeper(self, eff: StackEffect) -> None:
for peek in self.peeks:
Expand Down
0