From 37766ee8e4333aef569240dc7e08464e52221b14 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 7 Nov 2018 23:19:42 +0100 Subject: Add VarDeclPropagator to full suite and interactive optimizer. --- libyul/optimiser/Suite.cpp | 7 +++++++ test/tools/yulopti.cpp | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/libyul/optimiser/Suite.cpp b/libyul/optimiser/Suite.cpp index c7339d2e..7d52a5a8 100644 --- a/libyul/optimiser/Suite.cpp +++ b/libyul/optimiser/Suite.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include @@ -65,6 +66,7 @@ void OptimiserSuite::run( ExpressionSplitter{dispenser}(ast); SSATransform::run(ast, dispenser); RedundantAssignEliminator::run(ast); + VarDeclPropagator{}(ast); RedundantAssignEliminator::run(ast); CommonSubexpressionEliminator{}(ast); @@ -90,21 +92,26 @@ void OptimiserSuite::run( RedundantAssignEliminator::run(ast); CommonSubexpressionEliminator{}(ast); FullInliner{ast, dispenser}.run(); + VarDeclPropagator{}(ast); SSATransform::run(ast, dispenser); RedundantAssignEliminator::run(ast); + VarDeclPropagator{}(ast); RedundantAssignEliminator::run(ast); ExpressionSimplifier::run(ast); CommonSubexpressionEliminator{}(ast); SSATransform::run(ast, dispenser); RedundantAssignEliminator::run(ast); + VarDeclPropagator{}(ast); RedundantAssignEliminator::run(ast); UnusedPruner::runUntilStabilised(ast, reservedIdentifiers); } ExpressionJoiner::run(ast); + VarDeclPropagator{}(ast); UnusedPruner::runUntilStabilised(ast); ExpressionJoiner::run(ast); UnusedPruner::runUntilStabilised(ast); ExpressionJoiner::run(ast); + VarDeclPropagator{}(ast); UnusedPruner::runUntilStabilised(ast); ExpressionJoiner::run(ast); UnusedPruner::runUntilStabilised(ast); diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index 68fc9f4f..348c5f4a 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include @@ -120,7 +121,7 @@ public: m_nameDispenser = make_shared(*m_ast); disambiguated = true; } - cout << "(q)quit/(f)flatten/(c)se/(x)plit/(j)oin/(g)rouper/(h)oister/" << endl; + cout << "(q)quit/(f)flatten/(c)se/propagate var(d)ecls/(x)plit/(j)oin/(g)rouper/(h)oister/" << endl; cout << " (e)xpr inline/(i)nline/(s)implify/(u)nusedprune/ss(a) transform/" << endl; cout << " (r)edundant assign elim./re(m)aterializer? "; cout.flush(); @@ -136,6 +137,9 @@ public: case 'c': (CommonSubexpressionEliminator{})(*m_ast); break; + case 'd': + (VarDeclPropagator{})(*m_ast); + break; case 'x': ExpressionSplitter{*m_nameDispenser}(*m_ast); break; -- cgit