Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 30, 2024
1 parent 81ce4f8 commit 76441a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vyper/venom/venom_to_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ def _stack_reorder(
stack = stack.copy()

stack_ops_count = len(stack_ops)
if stack_ops_count == 0:
return 0

counts = Counter(stack_ops)

Expand All @@ -214,7 +216,7 @@ def _stack_reorder(
# this operand could ocure even more deeper in the stack
# but only those that are needed/relevant in calculation
# are considered
positions: dict[IROperand, list[int]] = defaultdict(lambda: [])
positions: dict[IROperand, list[int]] = defaultdict(list)
for op in stack_ops:
positions[op] = []
for i in range(counts[op]):
Expand Down Expand Up @@ -255,9 +257,7 @@ def _stack_reorder(

cost += self.swap(assembly, stack, final_stack_depth)

assert (
len(stack_ops) == 0 or stack._stack[-len(stack_ops) :] == stack_ops
), f"Wrong stack {stack} {stack_ops}"
assert stack._stack[-len(stack_ops) :] == stack_ops, (stack, stack_ops)

return cost

Expand Down

0 comments on commit 76441a8

Please sign in to comment.