Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix[venom]: fix unused variables pass #4259

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
3 changes: 3 additions & 0 deletions vyper/venom/analysis/dfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ def remove_use(self, op: IRVariable, inst: IRInstruction):
uses = self._dfg_inputs.get(op, [])
uses.remove(inst)

def remove_var(self, op: IRVariable):
self._dfg_outputs.pop(op)

@property
def outputs(self) -> dict[IRVariable, IRInstruction]:
return self._dfg_outputs
Expand Down
1 change: 1 addition & 0 deletions vyper/venom/passes/remove_unused_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,5 @@ def _process_instruction(self, inst):
new_uses = self.dfg.get_uses(operand)
self.work_list.addmany(new_uses)

self.dfg.remove_var(inst.output)
inst.parent.remove_instruction(inst)
Loading