Skip to content

Commit

Permalink
fix[venom]: fix return opcode handling in mem2var (#4011)
Browse files Browse the repository at this point in the history
the `mem2var` venom pass was creating an `mstore` instruction with a
bogus output variable when promoting a variable to memory for `RETURN`s.
  • Loading branch information
harkal authored May 9, 2024
1 parent a72185b commit 4a0305a
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions vyper/venom/passes/mem2var.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 4a0305a

Please sign in to comment.