Skip to content

Commit

Permalink
Merge branch 'master' into feat/venom/hevm-equivalence
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper authored Feb 6, 2025
2 parents 09a045d + 1aaa78e commit bed64d6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 7 additions & 3 deletions vyper/venom/basicblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ def get_outputs(self) -> list[IROperand]:
"""
return [self.output] if self.output else []

def make_nop(self):
self.annotation = str(self) # Keep original instruction as annotation for debugging
self.opcode = "nop"
self.output = None
self.operands = []

def flip(self):
"""
Flip operands for commutative or comparator opcodes
Expand Down Expand Up @@ -607,9 +613,7 @@ def fix_phi_instructions(self):
inst.opcode = "store"
inst.operands = [inst.operands[1]]
elif op_len == 0:
inst.opcode = "nop"
inst.output = None
inst.operands = []
inst.make_nop()

if needs_sort:
self.instructions.sort(key=lambda inst: inst.opcode != "phi")
Expand Down
3 changes: 1 addition & 2 deletions vyper/venom/passes/sccp/sccp.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,7 @@ def _replace_constants(self, inst: IRInstruction):

if isinstance(lat, IRLiteral):
if lat.value > 0:
inst.opcode = "nop"
inst.operands = []
inst.make_nop()
else:
raise StaticAssertionException(
f"assertion found to fail at compile time ({inst.error_msg}).",
Expand Down

0 comments on commit bed64d6

Please sign in to comment.