Skip to content

Commit

Permalink
better results this order
Browse files Browse the repository at this point in the history
  • Loading branch information
HodanPlodky committed Oct 6, 2024
1 parent 018b6a9 commit 94a9a6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ def test_common_subexpression_elimination():
bb.append_instruction("stop")

ac = IRAnalysesCache(fn)
from vyper.venom.analysis.available_expression import AvailableExpressionAnalysis
avail: AvailableExpressionAnalysis = ac.request_analysis(AvailableExpressionAnalysis)
print(fn)
for inst in bb.instructions:
print(avail.get_available(inst))

CSE(ac, fn).run_pass(1, 5)

Expand All @@ -43,7 +38,6 @@ def test_common_subexpression_elimination_effects_1():

ac = IRAnalysesCache(fn)

#ExtractLiteralsPass(ac, fn).run_pass()
CSE(ac, fn).run_pass()

assert sum(1 for inst in bb.instructions if inst.opcode == "add") == 2, "wrong number of adds"
Expand All @@ -65,7 +59,6 @@ def test_common_subexpression_elimination_effects_2():
bb.append_instruction("stop")

ac = IRAnalysesCache(fn)
#ExtractLiteralsPass(ac, fn).run_pass()
CSE(ac, fn).run_pass()

assert sum(1 for inst in bb.instructions if inst.opcode == "add") == 2, "wrong number of adds"
Expand All @@ -85,7 +78,6 @@ def test_common_subexpression_elimination_effect_mstore():
bb.append_instruction("stop")

ac = IRAnalysesCache(fn)
#ExtractLiteralsPass(ac, fn).run_pass()
CSE(ac, fn).run_pass(1, 5)

assert (
Expand Down
3 changes: 2 additions & 1 deletion vyper/venom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ def _run_passes(fn: IRFunction, optimize: OptimizationLevel) -> None:
SimplifyCFGPass(ac, fn).run_pass()
AlgebraicOptimizationPass(ac, fn).run_pass()
BranchOptimizationPass(ac, fn).run_pass()
CSE(ac, fn).run_pass(2, 10)

RemoveUnusedVariablesPass(ac, fn).run_pass()

StoreExpansionPass(ac, fn).run_pass()
CSE(ac, fn).run_pass(2, 10)
RemoveUnusedVariablesPass(ac, fn).run_pass()
DFTPass(ac, fn).run_pass()


Expand Down

0 comments on commit 94a9a6e

Please sign in to comment.