Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions vyper/venom/basicblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,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 @@ -601,9 +607,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
Loading