From a4835d0db79b74455b57c11848903ed757ebb128 Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sun, 27 Oct 2024 21:21:11 -0400 Subject: [PATCH] feat[venom]: reduce legacy opts when venom is enabled 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. --- vyper/codegen/ir_node.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vyper/codegen/ir_node.py b/vyper/codegen/ir_node.py index 6f9eb0359b..ff721fafcb 100644 --- a/vyper/codegen/ir_node.py +++ b/vyper/codegen/ir_node.py @@ -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 @@ -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