From a72185b6799eea603340c7a5289468aa33de7919 Mon Sep 17 00:00:00 2001 From: Harry Kalogirou Date: Thu, 9 May 2024 23:52:12 +0300 Subject: [PATCH 1/2] refactor[venom]: remove unused method in `make_ssa.py` (#4012) --- vyper/venom/passes/make_ssa.py | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/vyper/venom/passes/make_ssa.py b/vyper/venom/passes/make_ssa.py index fd7861930a..0ea3a20884 100644 --- a/vyper/venom/passes/make_ssa.py +++ b/vyper/venom/passes/make_ssa.py @@ -67,24 +67,6 @@ def _place_phi(self, var: IRVariable, basic_block: IRBasicBlock): basic_block.insert_instruction(IRInstruction("phi", args, var), 0) - def _add_phi(self, var: IRVariable, basic_block: IRBasicBlock) -> bool: - for inst in basic_block.instructions: - if inst.opcode == "phi" and inst.output is not None and inst.output.name == var.name: - return False - - args: list[IROperand] = [] - for bb in basic_block.cfg_in: - if bb == basic_block: - continue - - args.append(bb.label) - args.append(var) - - phi = IRInstruction("phi", args, var) - basic_block.instructions.insert(0, phi) - - return True - def _rename_vars(self, basic_block: IRBasicBlock): """ Rename variables. This follows the placement of phi nodes. From 4a0305a0e21a493d699279a5bf67b326642592f8 Mon Sep 17 00:00:00 2001 From: Harry Kalogirou Date: Fri, 10 May 2024 01:02:08 +0300 Subject: [PATCH 2/2] fix[venom]: fix return opcode handling in mem2var (#4011) the `mem2var` venom pass was creating an `mstore` instruction with a bogus output variable when promoting a variable to memory for `RETURN`s. --- vyper/venom/passes/mem2var.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/vyper/venom/passes/mem2var.py b/vyper/venom/passes/mem2var.py index 0ad9c411f1..eb9a6d52c5 100644 --- a/vyper/venom/passes/mem2var.py +++ b/vyper/venom/passes/mem2var.py @@ -53,10 +53,7 @@ def _process_alloca_var(self, dfg: DFGAnalysis, var: IRVariable): inst.operands = [IRVariable(var_name)] elif inst.opcode == "return": bb = inst.parent - new_var = self.function.get_next_variable() idx = bb.instructions.index(inst) bb.insert_instruction( - IRInstruction("mstore", [IRVariable(var_name), inst.operands[1]], new_var), - idx, + IRInstruction("mstore", [IRVariable(var_name), inst.operands[1]]), idx ) - inst.operands[1] = new_var