Skip to content

Commit

Permalink
handle regression
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Jan 14, 2025
1 parent 7cc3d08 commit 18feed6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vyper/venom/passes/algebraic_optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,15 @@ def _algebraic_opt_pass(self):
for bb in self.function.get_basic_blocks():
for inst in bb.instructions:
self._handle_inst_peephole(inst)
self._flip_inst(inst)

Check warning on line 188 in vyper/venom/passes/algebraic_optimization.py

View check run for this annotation

Codecov / codecov/patch

vyper/venom/passes/algebraic_optimization.py#L187-L188

Added lines #L187 - L188 were not covered by tests


def _flip_inst(self, inst: IRInstruction):
ops = inst.operands

Check warning on line 192 in vyper/venom/passes/algebraic_optimization.py

View check run for this annotation

Codecov / codecov/patch

vyper/venom/passes/algebraic_optimization.py#L192

Added line #L192 was not covered by tests
# improve code. this seems like it should be properly handled by
# better heuristics in DFT.
if (inst.flippable and self._is_lit(ops[0]) and not self._is_lit(ops[1])):
inst.flip()

Check warning on line 196 in vyper/venom/passes/algebraic_optimization.py

View check run for this annotation

Codecov / codecov/patch

vyper/venom/passes/algebraic_optimization.py#L196

Added line #L196 was not covered by tests

def _handle_inst_peephole(self, inst: IRInstruction):
if inst.output is None:
Expand Down

0 comments on commit 18feed6

Please sign in to comment.