From a24bc1c1618d84f229c3c59d79fe76ae11b5a64b Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sun, 13 Oct 2024 12:18:10 -0400 Subject: [PATCH 1/2] refactor[venom]: refactor module structure this commit refactors venom's analysis/ and passes/ module structure so that you can import analyses and passes directly from `vyper.venom.analysis` and `vyper.venom.passes` directly instead of needing to know the module names. this commit also removes the `stack_reorder.py` file, which is dead code. --- .../venom/test_algebraic_optimizer.py | 6 ++--- .../compiler/venom/test_branch_optimizer.py | 6 ++--- .../compiler/venom/test_dominator_tree.py | 5 ++-- .../compiler/venom/test_duplicate_operands.py | 4 ++-- tests/unit/compiler/venom/test_make_ssa.py | 4 ++-- .../compiler/venom/test_multi_entry_block.py | 5 ++-- tests/unit/compiler/venom/test_sccp.py | 5 ++-- .../unit/compiler/venom/test_simplify_cfg.py | 5 ++-- .../unit/compiler/venom/test_stack_reorder.py | 4 ++-- vyper/venom/__init__.py | 22 ++++++++++-------- vyper/venom/analysis/__init__.py | 6 +++++ vyper/venom/analysis/cfg.py | 5 ++-- vyper/venom/analysis/dfg.py | 3 +-- vyper/venom/analysis/dominators.py | 3 +-- vyper/venom/analysis/equivalent_vars.py | 3 +-- vyper/venom/analysis/liveness.py | 3 +-- vyper/venom/passes/__init__.py | 11 +++++++++ vyper/venom/passes/algebraic_optimization.py | 3 +-- vyper/venom/passes/base_pass.py | 2 +- vyper/venom/passes/branch_optimization.py | 2 +- vyper/venom/passes/dft.py | 2 +- vyper/venom/passes/make_ssa.py | 4 +--- vyper/venom/passes/mem2var.py | 4 +--- vyper/venom/passes/normalization.py | 2 +- vyper/venom/passes/remove_unused_variables.py | 3 +-- vyper/venom/passes/sccp/sccp.py | 4 +--- vyper/venom/passes/simplify_cfg.py | 2 +- vyper/venom/passes/stack_reorder.py | 23 ------------------- vyper/venom/passes/store_elimination.py | 4 +--- vyper/venom/passes/store_expansion.py | 3 +-- vyper/venom/venom_to_assembly.py | 6 ++--- 31 files changed, 67 insertions(+), 97 deletions(-) create mode 100644 vyper/venom/passes/__init__.py delete mode 100644 vyper/venom/passes/stack_reorder.py diff --git a/tests/unit/compiler/venom/test_algebraic_optimizer.py b/tests/unit/compiler/venom/test_algebraic_optimizer.py index b5d55efbdc..39008649ea 100644 --- a/tests/unit/compiler/venom/test_algebraic_optimizer.py +++ b/tests/unit/compiler/venom/test_algebraic_optimizer.py @@ -1,11 +1,9 @@ import pytest -from vyper.venom.analysis.analysis import IRAnalysesCache +from vyper.venom.analysis import IRAnalysesCache from vyper.venom.basicblock import IRBasicBlock, IRLabel from vyper.venom.context import IRContext -from vyper.venom.passes.algebraic_optimization import AlgebraicOptimizationPass -from vyper.venom.passes.make_ssa import MakeSSA -from vyper.venom.passes.remove_unused_variables import RemoveUnusedVariablesPass +from vyper.venom.passes import AlgebraicOptimizationPass, MakeSSA, RemoveUnusedVariablesPass @pytest.mark.parametrize("iszero_count", range(5)) diff --git a/tests/unit/compiler/venom/test_branch_optimizer.py b/tests/unit/compiler/venom/test_branch_optimizer.py index b6e806e217..82dff4777d 100644 --- a/tests/unit/compiler/venom/test_branch_optimizer.py +++ b/tests/unit/compiler/venom/test_branch_optimizer.py @@ -1,9 +1,7 @@ -from vyper.venom.analysis.analysis import IRAnalysesCache -from vyper.venom.analysis.dfg import DFGAnalysis +from vyper.venom.analysis import DFGAnalysis, IRAnalysesCache from vyper.venom.basicblock import IRBasicBlock, IRLabel from vyper.venom.context import IRContext -from vyper.venom.passes.branch_optimization import BranchOptimizationPass -from vyper.venom.passes.make_ssa import MakeSSA +from vyper.venom.passes import BranchOptimizationPass, MakeSSA def test_simple_jump_case(): diff --git a/tests/unit/compiler/venom/test_dominator_tree.py b/tests/unit/compiler/venom/test_dominator_tree.py index 29f86df221..30a2e4564e 100644 --- a/tests/unit/compiler/venom/test_dominator_tree.py +++ b/tests/unit/compiler/venom/test_dominator_tree.py @@ -2,12 +2,11 @@ from vyper.exceptions import CompilerPanic from vyper.utils import OrderedSet -from vyper.venom.analysis.analysis import IRAnalysesCache -from vyper.venom.analysis.dominators import DominatorTreeAnalysis +from vyper.venom.analysis import DominatorTreeAnalysis, IRAnalysesCache from vyper.venom.basicblock import IRBasicBlock, IRInstruction, IRLabel, IRLiteral, IRVariable from vyper.venom.context import IRContext from vyper.venom.function import IRFunction -from vyper.venom.passes.make_ssa import MakeSSA +from vyper.venom.passes import MakeSSA def _add_bb( diff --git a/tests/unit/compiler/venom/test_duplicate_operands.py b/tests/unit/compiler/venom/test_duplicate_operands.py index ab55649dae..89b06796e3 100644 --- a/tests/unit/compiler/venom/test_duplicate_operands.py +++ b/tests/unit/compiler/venom/test_duplicate_operands.py @@ -1,8 +1,8 @@ from vyper.compiler.settings import OptimizationLevel from vyper.venom import generate_assembly_experimental -from vyper.venom.analysis.analysis import IRAnalysesCache +from vyper.venom.analysis import IRAnalysesCache from vyper.venom.context import IRContext -from vyper.venom.passes.store_expansion import StoreExpansionPass +from vyper.venom.passes import StoreExpansionPass def test_duplicate_operands(): diff --git a/tests/unit/compiler/venom/test_make_ssa.py b/tests/unit/compiler/venom/test_make_ssa.py index 9cea1a20a4..aa3fead6bf 100644 --- a/tests/unit/compiler/venom/test_make_ssa.py +++ b/tests/unit/compiler/venom/test_make_ssa.py @@ -1,7 +1,7 @@ -from vyper.venom.analysis.analysis import IRAnalysesCache +from vyper.venom.analysis import IRAnalysesCache from vyper.venom.basicblock import IRBasicBlock, IRLabel from vyper.venom.context import IRContext -from vyper.venom.passes.make_ssa import MakeSSA +from vyper.venom.passes import MakeSSA def test_phi_case(): diff --git a/tests/unit/compiler/venom/test_multi_entry_block.py b/tests/unit/compiler/venom/test_multi_entry_block.py index 313fbb3ebd..a38e4b4158 100644 --- a/tests/unit/compiler/venom/test_multi_entry_block.py +++ b/tests/unit/compiler/venom/test_multi_entry_block.py @@ -1,8 +1,7 @@ -from vyper.venom.analysis.analysis import IRAnalysesCache -from vyper.venom.analysis.cfg import CFGAnalysis +from vyper.venom.analysis import CFGAnalysis, IRAnalysesCache from vyper.venom.context import IRContext from vyper.venom.function import IRBasicBlock, IRLabel -from vyper.venom.passes.normalization import NormalizationPass +from vyper.venom.passes import NormalizationPass def test_multi_entry_block_1(): diff --git a/tests/unit/compiler/venom/test_sccp.py b/tests/unit/compiler/venom/test_sccp.py index 478acc1079..375dfd5dac 100644 --- a/tests/unit/compiler/venom/test_sccp.py +++ b/tests/unit/compiler/venom/test_sccp.py @@ -1,11 +1,10 @@ import pytest from vyper.exceptions import StaticAssertionException -from vyper.venom.analysis.analysis import IRAnalysesCache +from vyper.venom.analysis import IRAnalysesCache from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRLiteral, IRVariable from vyper.venom.context import IRContext -from vyper.venom.passes.make_ssa import MakeSSA -from vyper.venom.passes.sccp import SCCP +from vyper.venom.passes import SCCP, MakeSSA from vyper.venom.passes.sccp.sccp import LatticeEnum diff --git a/tests/unit/compiler/venom/test_simplify_cfg.py b/tests/unit/compiler/venom/test_simplify_cfg.py index c4bdbb263b..3de6a77cc9 100644 --- a/tests/unit/compiler/venom/test_simplify_cfg.py +++ b/tests/unit/compiler/venom/test_simplify_cfg.py @@ -1,8 +1,7 @@ -from vyper.venom.analysis.analysis import IRAnalysesCache +from vyper.venom.analysis import IRAnalysesCache from vyper.venom.basicblock import IRBasicBlock, IRLabel, IRLiteral from vyper.venom.context import IRContext -from vyper.venom.passes.sccp import SCCP -from vyper.venom.passes.simplify_cfg import SimplifyCFGPass +from vyper.venom.passes import SCCP, SimplifyCFGPass def test_phi_reduction_after_block_pruning(): diff --git a/tests/unit/compiler/venom/test_stack_reorder.py b/tests/unit/compiler/venom/test_stack_reorder.py index a15dd4d540..8f38e00cdb 100644 --- a/tests/unit/compiler/venom/test_stack_reorder.py +++ b/tests/unit/compiler/venom/test_stack_reorder.py @@ -1,7 +1,7 @@ from vyper.venom import generate_assembly_experimental -from vyper.venom.analysis.analysis import IRAnalysesCache +from vyper.venom.analysis import IRAnalysesCache from vyper.venom.context import IRContext -from vyper.venom.passes.store_expansion import StoreExpansionPass +from vyper.venom.passes import StoreExpansionPass def test_stack_reorder(): diff --git a/vyper/venom/__init__.py b/vyper/venom/__init__.py index a5f51b787d..310147baa7 100644 --- a/vyper/venom/__init__.py +++ b/vyper/venom/__init__.py @@ -9,16 +9,18 @@ from vyper.venom.context import IRContext from vyper.venom.function import IRFunction from vyper.venom.ir_node_to_venom import ir_node_to_venom -from vyper.venom.passes.algebraic_optimization import AlgebraicOptimizationPass -from vyper.venom.passes.branch_optimization import BranchOptimizationPass -from vyper.venom.passes.dft import DFTPass -from vyper.venom.passes.make_ssa import MakeSSA -from vyper.venom.passes.mem2var import Mem2Var -from vyper.venom.passes.remove_unused_variables import RemoveUnusedVariablesPass -from vyper.venom.passes.sccp import SCCP -from vyper.venom.passes.simplify_cfg import SimplifyCFGPass -from vyper.venom.passes.store_elimination import StoreElimination -from vyper.venom.passes.store_expansion import StoreExpansionPass +from vyper.venom.passes import ( + SCCP, + AlgebraicOptimizationPass, + BranchOptimizationPass, + DFTPass, + MakeSSA, + Mem2Var, + RemoveUnusedVariablesPass, + SimplifyCFGPass, + StoreElimination, + StoreExpansionPass, +) from vyper.venom.venom_to_assembly import VenomCompiler DEFAULT_OPT_LEVEL = OptimizationLevel.default() diff --git a/vyper/venom/analysis/__init__.py b/vyper/venom/analysis/__init__.py index e69de29bb2..4870de3fb7 100644 --- a/vyper/venom/analysis/__init__.py +++ b/vyper/venom/analysis/__init__.py @@ -0,0 +1,6 @@ +from .analysis import IRAnalysesCache, IRAnalysis +from .cfg import CFGAnalysis +from .dfg import DFGAnalysis +from .dominators import DominatorTreeAnalysis +from .equivalent_vars import VarEquivalenceAnalysis +from .liveness import LivenessAnalysis diff --git a/vyper/venom/analysis/cfg.py b/vyper/venom/analysis/cfg.py index bd2ae34b68..e4f130bc18 100644 --- a/vyper/venom/analysis/cfg.py +++ b/vyper/venom/analysis/cfg.py @@ -1,5 +1,5 @@ from vyper.utils import OrderedSet -from vyper.venom.analysis.analysis import IRAnalysis +from vyper.venom.analysis import IRAnalysis from vyper.venom.basicblock import CFG_ALTERING_INSTRUCTIONS @@ -32,8 +32,7 @@ def analyze(self) -> None: in_bb.add_cfg_out(bb) def invalidate(self): - from vyper.venom.analysis.dominators import DominatorTreeAnalysis - from vyper.venom.analysis.liveness import LivenessAnalysis + from vyper.venom.analysis import DominatorTreeAnalysis, LivenessAnalysis self.analyses_cache.invalidate_analysis(DominatorTreeAnalysis) self.analyses_cache.invalidate_analysis(LivenessAnalysis) diff --git a/vyper/venom/analysis/dfg.py b/vyper/venom/analysis/dfg.py index 328ed47c72..51c2a4cb1f 100644 --- a/vyper/venom/analysis/dfg.py +++ b/vyper/venom/analysis/dfg.py @@ -1,7 +1,6 @@ from typing import Optional -from vyper.venom.analysis.analysis import IRAnalysesCache, IRAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import IRAnalysesCache, IRAnalysis, LivenessAnalysis from vyper.venom.basicblock import IRInstruction, IRVariable from vyper.venom.function import IRFunction diff --git a/vyper/venom/analysis/dominators.py b/vyper/venom/analysis/dominators.py index 129d1d0f22..e360df36b9 100644 --- a/vyper/venom/analysis/dominators.py +++ b/vyper/venom/analysis/dominators.py @@ -1,7 +1,6 @@ from vyper.exceptions import CompilerPanic from vyper.utils import OrderedSet -from vyper.venom.analysis.analysis import IRAnalysis -from vyper.venom.analysis.cfg import CFGAnalysis +from vyper.venom.analysis import CFGAnalysis, IRAnalysis from vyper.venom.basicblock import IRBasicBlock from vyper.venom.function import IRFunction diff --git a/vyper/venom/analysis/equivalent_vars.py b/vyper/venom/analysis/equivalent_vars.py index 9b0c03e3d1..895895651a 100644 --- a/vyper/venom/analysis/equivalent_vars.py +++ b/vyper/venom/analysis/equivalent_vars.py @@ -1,5 +1,4 @@ -from vyper.venom.analysis.analysis import IRAnalysis -from vyper.venom.analysis.dfg import DFGAnalysis +from vyper.venom.analysis import DFGAnalysis, IRAnalysis from vyper.venom.basicblock import IRVariable diff --git a/vyper/venom/analysis/liveness.py b/vyper/venom/analysis/liveness.py index 2a471bc8be..b5d65961b7 100644 --- a/vyper/venom/analysis/liveness.py +++ b/vyper/venom/analysis/liveness.py @@ -2,8 +2,7 @@ from vyper.exceptions import CompilerPanic from vyper.utils import OrderedSet -from vyper.venom.analysis.analysis import IRAnalysis -from vyper.venom.analysis.cfg import CFGAnalysis +from vyper.venom.analysis import CFGAnalysis, IRAnalysis from vyper.venom.basicblock import IRBasicBlock, IRVariable diff --git a/vyper/venom/passes/__init__.py b/vyper/venom/passes/__init__.py new file mode 100644 index 0000000000..83098234c1 --- /dev/null +++ b/vyper/venom/passes/__init__.py @@ -0,0 +1,11 @@ +from .algebraic_optimization import AlgebraicOptimizationPass +from .branch_optimization import BranchOptimizationPass +from .dft import DFTPass +from .make_ssa import MakeSSA +from .mem2var import Mem2Var +from .normalization import NormalizationPass +from .remove_unused_variables import RemoveUnusedVariablesPass +from .sccp import SCCP +from .simplify_cfg import SimplifyCFGPass +from .store_elimination import StoreElimination +from .store_expansion import StoreExpansionPass diff --git a/vyper/venom/passes/algebraic_optimization.py b/vyper/venom/passes/algebraic_optimization.py index 1d375ea988..5d4291667e 100644 --- a/vyper/venom/passes/algebraic_optimization.py +++ b/vyper/venom/passes/algebraic_optimization.py @@ -1,5 +1,4 @@ -from vyper.venom.analysis.dfg import DFGAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import DFGAnalysis, LivenessAnalysis from vyper.venom.basicblock import IRInstruction, IRLabel, IRLiteral, IROperand from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/base_pass.py b/vyper/venom/passes/base_pass.py index 4d1bfe9647..3951ac4455 100644 --- a/vyper/venom/passes/base_pass.py +++ b/vyper/venom/passes/base_pass.py @@ -1,4 +1,4 @@ -from vyper.venom.analysis.analysis import IRAnalysesCache +from vyper.venom.analysis import IRAnalysesCache from vyper.venom.function import IRFunction diff --git a/vyper/venom/passes/branch_optimization.py b/vyper/venom/passes/branch_optimization.py index 354aab7900..d5b0ed9809 100644 --- a/vyper/venom/passes/branch_optimization.py +++ b/vyper/venom/passes/branch_optimization.py @@ -1,4 +1,4 @@ -from vyper.venom.analysis.dfg import DFGAnalysis +from vyper.venom.analysis import DFGAnalysis from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/dft.py b/vyper/venom/passes/dft.py index f45a60079c..85f27867a7 100644 --- a/vyper/venom/passes/dft.py +++ b/vyper/venom/passes/dft.py @@ -1,5 +1,5 @@ from vyper.utils import OrderedSet -from vyper.venom.analysis.dfg import DFGAnalysis +from vyper.venom.analysis import DFGAnalysis from vyper.venom.basicblock import IRBasicBlock, IRInstruction, IRVariable from vyper.venom.function import IRFunction from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/make_ssa.py b/vyper/venom/passes/make_ssa.py index a803514d8b..56d3e1b7d3 100644 --- a/vyper/venom/passes/make_ssa.py +++ b/vyper/venom/passes/make_ssa.py @@ -1,7 +1,5 @@ from vyper.utils import OrderedSet -from vyper.venom.analysis.cfg import CFGAnalysis -from vyper.venom.analysis.dominators import DominatorTreeAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import CFGAnalysis, DominatorTreeAnalysis, LivenessAnalysis from vyper.venom.basicblock import IRBasicBlock, IRInstruction, IROperand, IRVariable from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/mem2var.py b/vyper/venom/passes/mem2var.py index 74977d6279..f93924d449 100644 --- a/vyper/venom/passes/mem2var.py +++ b/vyper/venom/passes/mem2var.py @@ -1,6 +1,4 @@ -from vyper.venom.analysis.cfg import CFGAnalysis -from vyper.venom.analysis.dfg import DFGAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import CFGAnalysis, DFGAnalysis, LivenessAnalysis from vyper.venom.basicblock import IRInstruction, IRVariable from vyper.venom.function import IRFunction from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/normalization.py b/vyper/venom/passes/normalization.py index cf44c3cf89..7ca242c74e 100644 --- a/vyper/venom/passes/normalization.py +++ b/vyper/venom/passes/normalization.py @@ -1,5 +1,5 @@ from vyper.exceptions import CompilerPanic -from vyper.venom.analysis.cfg import CFGAnalysis +from vyper.venom.analysis import CFGAnalysis from vyper.venom.basicblock import IRBasicBlock, IRLabel from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/remove_unused_variables.py b/vyper/venom/passes/remove_unused_variables.py index be9c1ed535..20f0a55333 100644 --- a/vyper/venom/passes/remove_unused_variables.py +++ b/vyper/venom/passes/remove_unused_variables.py @@ -1,6 +1,5 @@ from vyper.utils import OrderedSet -from vyper.venom.analysis.dfg import DFGAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import DFGAnalysis, LivenessAnalysis from vyper.venom.basicblock import IRInstruction from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/sccp/sccp.py b/vyper/venom/passes/sccp/sccp.py index 8596bc8405..7966863081 100644 --- a/vyper/venom/passes/sccp/sccp.py +++ b/vyper/venom/passes/sccp/sccp.py @@ -5,9 +5,7 @@ from vyper.exceptions import CompilerPanic, StaticAssertionException from vyper.utils import OrderedSet -from vyper.venom.analysis.analysis import IRAnalysesCache -from vyper.venom.analysis.cfg import CFGAnalysis -from vyper.venom.analysis.dominators import DominatorTreeAnalysis +from vyper.venom.analysis import CFGAnalysis, DominatorTreeAnalysis, IRAnalysesCache from vyper.venom.basicblock import ( IRBasicBlock, IRInstruction, diff --git a/vyper/venom/passes/simplify_cfg.py b/vyper/venom/passes/simplify_cfg.py index 1409f43947..acf37376e0 100644 --- a/vyper/venom/passes/simplify_cfg.py +++ b/vyper/venom/passes/simplify_cfg.py @@ -1,6 +1,6 @@ from vyper.exceptions import CompilerPanic from vyper.utils import OrderedSet -from vyper.venom.analysis.cfg import CFGAnalysis +from vyper.venom.analysis import CFGAnalysis from vyper.venom.basicblock import IRBasicBlock, IRLabel from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/stack_reorder.py b/vyper/venom/passes/stack_reorder.py deleted file mode 100644 index a92fe0e626..0000000000 --- a/vyper/venom/passes/stack_reorder.py +++ /dev/null @@ -1,23 +0,0 @@ -from vyper.utils import OrderedSet -from vyper.venom.basicblock import IRBasicBlock -from vyper.venom.passes.base_pass import IRPass - - -class StackReorderPass(IRPass): - visited: OrderedSet - - def _reorder_stack(self): - pass - - def _visit(self, bb: IRBasicBlock): - if bb in self.visited: - return - self.visited.add(bb) - - for bb_out in bb.cfg_out: - self._visit(bb_out) - - def _run_pass(self): - entry = self.function.entry - self.visited = OrderedSet() - self._visit(entry) diff --git a/vyper/venom/passes/store_elimination.py b/vyper/venom/passes/store_elimination.py index 17b9ce995a..0ecd324e26 100644 --- a/vyper/venom/passes/store_elimination.py +++ b/vyper/venom/passes/store_elimination.py @@ -1,6 +1,4 @@ -from vyper.venom.analysis.cfg import CFGAnalysis -from vyper.venom.analysis.dfg import DFGAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import CFGAnalysis, DFGAnalysis, LivenessAnalysis from vyper.venom.basicblock import IRVariable from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/passes/store_expansion.py b/vyper/venom/passes/store_expansion.py index 7718e67d33..be5eb3d95d 100644 --- a/vyper/venom/passes/store_expansion.py +++ b/vyper/venom/passes/store_expansion.py @@ -1,5 +1,4 @@ -from vyper.venom.analysis.dfg import DFGAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import DFGAnalysis, LivenessAnalysis from vyper.venom.basicblock import IRInstruction, IRLiteral, IRVariable from vyper.venom.passes.base_pass import IRPass diff --git a/vyper/venom/venom_to_assembly.py b/vyper/venom/venom_to_assembly.py index 21e3b5e5aa..ee4b83201d 100644 --- a/vyper/venom/venom_to_assembly.py +++ b/vyper/venom/venom_to_assembly.py @@ -10,9 +10,7 @@ optimize_assembly, ) from vyper.utils import MemoryPositions, OrderedSet -from vyper.venom.analysis.analysis import IRAnalysesCache -from vyper.venom.analysis.equivalent_vars import VarEquivalenceAnalysis -from vyper.venom.analysis.liveness import LivenessAnalysis +from vyper.venom.analysis import IRAnalysesCache, LivenessAnalysis, VarEquivalenceAnalysis from vyper.venom.basicblock import ( IRBasicBlock, IRInstruction, @@ -22,7 +20,7 @@ IRVariable, ) from vyper.venom.context import IRContext -from vyper.venom.passes.normalization import NormalizationPass +from vyper.venom.passes import NormalizationPass from vyper.venom.stack_model import StackModel DEBUG_SHOW_COST = False From 2321a3d5fa504132b5b330886eb1005af488624f Mon Sep 17 00:00:00 2001 From: Charles Cooper Date: Sun, 13 Oct 2024 14:29:19 -0400 Subject: [PATCH 2/2] fix a cycle --- vyper/venom/analysis/dfg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vyper/venom/analysis/dfg.py b/vyper/venom/analysis/dfg.py index 51c2a4cb1f..328ed47c72 100644 --- a/vyper/venom/analysis/dfg.py +++ b/vyper/venom/analysis/dfg.py @@ -1,6 +1,7 @@ from typing import Optional -from vyper.venom.analysis import IRAnalysesCache, IRAnalysis, LivenessAnalysis +from vyper.venom.analysis.analysis import IRAnalysesCache, IRAnalysis +from vyper.venom.analysis.liveness import LivenessAnalysis from vyper.venom.basicblock import IRInstruction, IRVariable from vyper.venom.function import IRFunction