Skip to content

Commit

Permalink
fix stability of _get_symbols_common
Browse files Browse the repository at this point in the history
this affects liveness analysis downstream.
  • Loading branch information
charles-cooper committed Oct 28, 2023
1 parent 5b43039 commit 4554e6f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions vyper/ir/ir_to_bb_pass.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,15 @@


def _get_symbols_common(a: dict, b: dict) -> dict:
return {k: [a[k], b[k]] for k in a.keys() & b.keys() if a[k] != b[k]}
ret = {}
# preserves the ordering in `a`
for k in a.keys():
if k not in b:
continue
if a[k] == b[k]:
continue
ret[k] = a[k], b[k]
return ret


def generate_assembly_experimental(
Expand Down Expand Up @@ -413,7 +421,8 @@ def _convert_ir_basicblock(
)
)

for sym, val in _get_symbols_common(after_then_syms, after_else_syms).items():
common_symbols = _get_symbols_common(after_then_syms, after_else_syms)
for sym, val in common_symbols.items():
ret = ctx.get_next_variable()
old_var = symbols.get(sym, None)
symbols[sym] = ret
Expand Down

0 comments on commit 4554e6f

Please sign in to comment.