Skip to content

feat[venom]: Entry instructions reordering #4616

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

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
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
22 changes: 16 additions & 6 deletions vyper/venom/passes/dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,25 @@ def _calculate_dependency_graphs(self, bb: IRBasicBlock) -> None:
write_effects = inst.get_write_effects()
read_effects = inst.get_read_effects()

for write_effect in write_effects:
if write_effect in last_read_effects:
self.eda[inst].add(last_read_effects[write_effect])
last_write_effects[write_effect] = inst
for effect in read_effects:
# Read depends on last write to the same effect
if effect in last_write_effects and last_write_effects[effect] != inst:
self.eda[inst].add(last_write_effects[effect])

for effect in write_effects:
# Write depends on last read to the same effect
if effect in last_read_effects and last_read_effects[effect] != inst:
self.eda[inst].add(last_read_effects[effect])

# Write depends on last write to the same effect
if effect in last_write_effects and last_write_effects[effect] != inst:
self.eda[inst].add(last_write_effects[effect])

# Update the last read/write effect trackers
for read_effect in read_effects:
if read_effect in last_write_effects and last_write_effects[read_effect] != inst:
self.eda[inst].add(last_write_effects[read_effect])
last_read_effects[read_effect] = inst
for write_effect in write_effects:
last_write_effects[write_effect] = inst

def _calculate_data_offspring(self, inst: IRInstruction):
if inst in self.data_offspring:
Expand Down
Loading