Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat[venom]: add support for no optimizations #4315

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions vyper/venom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,22 @@ def generate_assembly_experimental(

def _run_passes(fn: IRFunction, optimize: OptimizationLevel) -> None:
# Run passes on Venom IR
# TODO: Add support for optimization levels

ac = IRAnalysesCache(fn)

SimplifyCFGPass(ac, fn).run_pass()
MakeSSA(ac, fn).run_pass()

if optimize == OptimizationLevel.NONE:
StoreExpansionPass(ac, fn).run_pass()
return

Mem2Var(ac, fn).run_pass()
MakeSSA(ac, fn).run_pass()

SCCP(ac, fn).run_pass()
StoreElimination(ac, fn).run_pass()
SimplifyCFGPass(ac, fn).run_pass()

AlgebraicOptimizationPass(ac, fn).run_pass()
# NOTE: MakeSSA is after algebraic optimization it currently produces
# smaller code by adding some redundant phi nodes. This is not a
Expand All @@ -62,9 +67,12 @@ def _run_passes(fn: IRFunction, optimize: OptimizationLevel) -> None:
# without making the code generation more expensive by running
# MakeSSA again.
MakeSSA(ac, fn).run_pass()

BranchOptimizationPass(ac, fn).run_pass()
RemoveUnusedVariablesPass(ac, fn).run_pass()

# TODO: codesize optimizations, e.g. for literals

StoreExpansionPass(ac, fn).run_pass()
DFTPass(ac, fn).run_pass()

Expand Down
Loading