Skip to content

Commit

Permalink
feat[venom]: reduce legacy opts when venom is enabled (#4336)
Browse files Browse the repository at this point in the history
reduce legacy IR optimization when venom is enabled. the use of
`IRnode._optimized` was there to decide if it was safe to inline an
IRnode expression or it required a `with` statement; with venom, we
don't need to inline the expressions, since the venom optimizer is more
powerful. this leads to a 50% improvement in AST -> IRnode generation,
which is a ~15% performance improvement in overall end-to-end compile
time.
  • Loading branch information
charles-cooper authored Oct 29, 2024
1 parent 3fba8c7 commit fcddb70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion vyper/codegen/ir_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from typing import Any, List, Optional, Union

import vyper.ast as vy_ast
from vyper.compiler.settings import VYPER_COLOR_OUTPUT
from vyper.compiler.settings import VYPER_COLOR_OUTPUT, get_global_settings
from vyper.evm.address_space import AddrSpace
from vyper.evm.opcodes import get_ir_opcodes
from vyper.exceptions import CodegenPanic, CompilerPanic
Expand Down Expand Up @@ -426,6 +426,10 @@ def is_pointer(self) -> bool:

@property # probably could be cached_property but be paranoid
def _optimized(self):
if get_global_settings().experimental_codegen:
# in venom pipeline, we don't need to inline constants.
return self

# TODO figure out how to fix this circular import
from vyper.ir.optimizer import optimize

Expand Down

0 comments on commit fcddb70

Please sign in to comment.