Skip to content

Commit

Permalink
fix IRLiteral order
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Sep 25, 2024
1 parent 5db771f commit 32d7393
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions vyper/venom/passes/algebraic_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def _handle_offsets(self):
if inst.opcode != "add":
continue
ops = inst.operands
if isinstance(ops[1], IRLabel):
# assembler expects IRLabel as second operand
if isinstance(ops[0], IRLabel):
# add is commutative
ops.reverse()
if isinstance(ops[0], IRLabel) and isinstance(ops[1], IRLiteral):
if isinstance(ops[1], IRLabel) and isinstance(ops[0], IRLiteral):
inst.opcode = "offset"

def run_pass(self):
Expand Down

0 comments on commit 32d7393

Please sign in to comment.