mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Really split structural simplifier.
This commit is contained in:
parent
d9831c8b96
commit
dd4f9bf1a6
test
@ -231,10 +231,14 @@ TestCase::TestResult YulOptimizerTest::run(ostream& _stream, string const& _line
|
|||||||
SSATransform::run(*m_ast, nameDispenser);
|
SSATransform::run(*m_ast, nameDispenser);
|
||||||
RedundantAssignEliminator::run(*m_dialect, *m_ast);
|
RedundantAssignEliminator::run(*m_dialect, *m_ast);
|
||||||
}
|
}
|
||||||
else if (m_optimizerStep == "structuralSimplifier")
|
else if (m_optimizerStep == "controlFlowSimplifier")
|
||||||
{
|
{
|
||||||
disambiguate();
|
disambiguate();
|
||||||
ControlFlowSimplifier{}(*m_ast);
|
ControlFlowSimplifier{}(*m_ast);
|
||||||
|
}
|
||||||
|
else if (m_optimizerStep == "structuralSimplifier")
|
||||||
|
{
|
||||||
|
disambiguate();
|
||||||
StructuralSimplifier{*m_dialect}(*m_ast);
|
StructuralSimplifier{*m_dialect}(*m_ast);
|
||||||
}
|
}
|
||||||
else if (m_optimizerStep == "equivalentFunctionCombiner")
|
else if (m_optimizerStep == "equivalentFunctionCombiner")
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{ let a := mload(0) if a {} }
|
{ let a := mload(0) if a {} }
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
// let a := mload(0)
|
// let a := mload(0)
|
@ -1,5 +1,5 @@
|
|||||||
{ if mload(0) {} }
|
{ if mload(0) {} }
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// { pop(mload(0)) }
|
// { pop(mload(0)) }
|
@ -2,7 +2,7 @@
|
|||||||
switch mload(0) default { mstore(1, 2) }
|
switch mload(0) default { mstore(1, 2) }
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
// pop(mload(0))
|
// pop(mload(0))
|
@ -11,7 +11,7 @@
|
|||||||
default { }
|
default { }
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
@ -6,7 +6,7 @@
|
|||||||
case 2 { y := 10 }
|
case 2 { y := 10 }
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
@ -6,7 +6,7 @@
|
|||||||
default { }
|
default { }
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
@ -6,7 +6,7 @@
|
|||||||
default { }
|
default { }
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
@ -2,7 +2,7 @@
|
|||||||
switch calldataload(0) case 2 { mstore(0, 0) }
|
switch calldataload(0) case 2 { mstore(0, 0) }
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// step: structuralSimplifier
|
// step: controlFlowSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
// if eq(2, calldataload(0)) { mstore(0, 0) }
|
// if eq(2, calldataload(0)) { mstore(0, 0) }
|
@ -32,6 +32,7 @@
|
|||||||
#include <libyul/optimiser/BlockFlattener.h>
|
#include <libyul/optimiser/BlockFlattener.h>
|
||||||
#include <libyul/optimiser/Disambiguator.h>
|
#include <libyul/optimiser/Disambiguator.h>
|
||||||
#include <libyul/optimiser/CommonSubexpressionEliminator.h>
|
#include <libyul/optimiser/CommonSubexpressionEliminator.h>
|
||||||
|
#include <libyul/optimiser/ControlFlowSimplifier.h>
|
||||||
#include <libyul/optimiser/NameCollector.h>
|
#include <libyul/optimiser/NameCollector.h>
|
||||||
#include <libyul/optimiser/EquivalentFunctionCombiner.h>
|
#include <libyul/optimiser/EquivalentFunctionCombiner.h>
|
||||||
#include <libyul/optimiser/ExpressionSplitter.h>
|
#include <libyul/optimiser/ExpressionSplitter.h>
|
||||||
@ -130,7 +131,7 @@ public:
|
|||||||
cout << " (e)xpr inline/(i)nline/(s)implify/varname c(l)eaner/(u)nusedprune/ss(a) transform/" << endl;
|
cout << " (e)xpr inline/(i)nline/(s)implify/varname c(l)eaner/(u)nusedprune/ss(a) transform/" << endl;
|
||||||
cout << " (r)edundant assign elim./re(m)aterializer/f(o)r-loop-pre-rewriter/" << endl;
|
cout << " (r)edundant assign elim./re(m)aterializer/f(o)r-loop-pre-rewriter/" << endl;
|
||||||
cout << " s(t)ructural simplifier/equi(v)alent function combiner/ssa re(V)erser/? " << endl;
|
cout << " s(t)ructural simplifier/equi(v)alent function combiner/ssa re(V)erser/? " << endl;
|
||||||
cout << " stack com(p)ressor/(D)ead code eliminator/? " << endl;
|
cout << " co(n)trol flow simplifier/stack com(p)ressor/(D)ead code eliminator/? " << endl;
|
||||||
cout.flush();
|
cout.flush();
|
||||||
int option = readStandardInputChar();
|
int option = readStandardInputChar();
|
||||||
cout << ' ' << char(option) << endl;
|
cout << ' ' << char(option) << endl;
|
||||||
@ -177,6 +178,9 @@ public:
|
|||||||
case 't':
|
case 't':
|
||||||
(StructuralSimplifier{*m_dialect})(*m_ast);
|
(StructuralSimplifier{*m_dialect})(*m_ast);
|
||||||
break;
|
break;
|
||||||
|
case 'n':
|
||||||
|
(ControlFlowSimplifier{})(*m_ast);
|
||||||
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
UnusedPruner::runUntilStabilised(*m_dialect, *m_ast);
|
UnusedPruner::runUntilStabilised(*m_dialect, *m_ast);
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user