Skip to content

Commit

Permalink
fix[venom]: clear out_vars during calculation (#4129)
Browse files Browse the repository at this point in the history
Clear `out_vars` set at start of calculations

When computing `out_vars` for each basic block, we perform set unions
of variables expected by all successor basic blocks of the current block.
This commit clears the `out_vars` set at the beginning of the calculations.

---------

Co-authored-by: Charles Cooper <cooper.charles.m@gmail.com>
  • Loading branch information
harkal and charles-cooper authored Jun 12, 2024
1 parent 7770967 commit 153262b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion vyper/venom/analysis/liveness.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def _calculate_out_vars(self, bb: IRBasicBlock) -> bool:
Compute out_vars of basic block.
Returns True if out_vars changed
"""
out_vars = bb.out_vars.copy()
out_vars = bb.out_vars
bb.out_vars = OrderedSet()
for out_bb in bb.cfg_out:
target_vars = self.input_vars_from(bb, out_bb)
bb.out_vars = bb.out_vars.union(target_vars)
Expand Down

0 comments on commit 153262b

Please sign in to comment.