Skip to content

Commit

Permalink
Merge branch 'master' into feat/infer_expected_types
Browse files Browse the repository at this point in the history
  • Loading branch information
charles-cooper committed Mar 3, 2025
2 parents 048af7f + 7d921e9 commit 00e4c0d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/release-notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Release Notes
v0.4.1 ("Tokara Habu")
**********************

Date released: 2025-02-27
Date released: 2025-03-01
=========================

v0.4.1 is primarily a polishing release, focusing on bug fixes, UX improvements, and security-related fixes (with four low-to-moderate severity GHSA reports published). However, a substantial amount of effort has also been invested in improving the Venom pipeline, resulting in better performance and code generation from the Venom pipeline. Venom can be enabled by passing the ``--venom`` or ``--experimental-codegen`` flag to the Vyper compiler (they are aliases of each other). Venom code can now also be compiled directly, using the ``venom`` binary (included in this release).
Expand Down
7 changes: 7 additions & 0 deletions vyper/venom/basicblock.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ def __init__(self, name: str, version: int = 0) -> None:
value = f"{name}:{version}"
super().__init__(value)

def with_version(self, version: int) -> "IRVariable":
if version == self.version:
# IRVariable ctor is a hotspot, try to avoid calling it
# if possible
return self
return self.__class__(self.name, version)

@property
def name(self) -> str:
return self._name
Expand Down
14 changes: 9 additions & 5 deletions vyper/venom/passes/make_ssa.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ def _place_phi(self, var: IRVariable, basic_block: IRBasicBlock):

basic_block.insert_instruction(IRInstruction("phi", args, var), 0)

def latest_version_of(self, var: IRVariable) -> IRVariable:
name = var.name
version = self.var_name_stacks[name][-1]
return var.with_version(version)

def _rename_vars(self, basic_block: IRBasicBlock):
"""
Rename variables. This follows the placement of phi nodes.
Expand All @@ -84,7 +89,8 @@ def _rename_vars(self, basic_block: IRBasicBlock):
new_ops.append(op)
continue

new_ops.append(IRVariable(op.name, version=self.var_name_stacks[op.name][-1]))
op = self.latest_version_of(op)
new_ops.append(op)

inst.operands = new_ops

Expand All @@ -95,7 +101,7 @@ def _rename_vars(self, basic_block: IRBasicBlock):
self.var_name_stacks[v_name].append(i)
self.var_name_counters[v_name] = i + 1

inst.output = IRVariable(v_name, version=i)
inst.output = self.latest_version_of(inst.output)
outs.append(inst.output.name)

for bb in basic_block.cfg_out:
Expand All @@ -106,9 +112,7 @@ def _rename_vars(self, basic_block: IRBasicBlock):
for i, op in enumerate(inst.operands):
if op == basic_block.label:
var = inst.operands[i + 1]
inst.operands[i + 1] = IRVariable(
var.name, version=self.var_name_stacks[var.name][-1]
)
inst.operands[i + 1] = self.latest_version_of(var)

for bb in self.dom.dominated[basic_block]:
if bb == basic_block:
Expand Down

0 comments on commit 00e4c0d

Please sign in to comment.