diff options
author | chriseth <chris@ethereum.org> | 2018-10-16 23:01:13 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-10-17 23:21:55 +0800 |
commit | 732d09cef1548e2111c47b6f5b04a54db10a9d41 (patch) | |
tree | 757af93eb855da8de07c99d5429be27a95f78ab1 /test/libyul | |
parent | f2f72ff7eea9a461ae8c71a13428e499c8b91025 (diff) | |
download | dexon-solidity-732d09cef1548e2111c47b6f5b04a54db10a9d41.tar.gz dexon-solidity-732d09cef1548e2111c47b6f5b04a54db10a9d41.tar.zst dexon-solidity-732d09cef1548e2111c47b6f5b04a54db10a9d41.zip |
Limit size of generated names and add convenience constructors.
Diffstat (limited to 'test/libyul')
-rw-r--r-- | test/libyul/YulOptimizerTest.cpp | 9 | ||||
-rw-r--r-- | test/libyul/yulOptimizerTests/disambiguator/long_names.yul | 12 | ||||
-rw-r--r-- | test/libyul/yulOptimizerTests/fullInliner/long_names.yul | 25 |
3 files changed, 40 insertions, 6 deletions
diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index 8e4771c8..a89711a1 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -106,8 +106,7 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con } else if (m_optimizerStep == "expressionSplitter") { - NameDispenser nameDispenser; - nameDispenser.m_usedNames = NameCollector(*m_ast).names(); + NameDispenser nameDispenser(*m_ast); ExpressionSplitter{nameDispenser}(*m_ast); } else if (m_optimizerStep == "functionGrouper") @@ -130,8 +129,7 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con disambiguate(); (FunctionHoister{})(*m_ast); (FunctionGrouper{})(*m_ast); - NameDispenser nameDispenser; - nameDispenser.m_usedNames = NameCollector(*m_ast).names(); + NameDispenser nameDispenser(*m_ast); ExpressionSplitter{nameDispenser}(*m_ast); FullInliner(*m_ast).run(); ExpressionJoiner::run(*m_ast); @@ -155,8 +153,7 @@ bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool con else if (m_optimizerStep == "fullSimplify") { disambiguate(); - NameDispenser nameDispenser; - nameDispenser.m_usedNames = NameCollector(*m_ast).names(); + NameDispenser nameDispenser(*m_ast); ExpressionSplitter{nameDispenser}(*m_ast); CommonSubexpressionEliminator{}(*m_ast); ExpressionSimplifier::run(*m_ast); diff --git a/test/libyul/yulOptimizerTests/disambiguator/long_names.yul b/test/libyul/yulOptimizerTests/disambiguator/long_names.yul new file mode 100644 index 00000000..933e1e8f --- /dev/null +++ b/test/libyul/yulOptimizerTests/disambiguator/long_names.yul @@ -0,0 +1,12 @@ +// yul +{ { let aanteuhdaoneudbrgkjiuaothduiathudaoeuh:u256 } { let aanteuhdaoneudbrgkjiuaothduiathudaoeuh:u256 } } +// ---- +// disambiguator +// { +// { +// let aanteuhdaoneudbrgkjiuaothduiathudaoeuh:u256 +// } +// { +// let aanteuhdaoneudbrgkjiuaothduiathudaoeuh_1:u256 +// } +// } diff --git a/test/libyul/yulOptimizerTests/fullInliner/long_names.yul b/test/libyul/yulOptimizerTests/fullInliner/long_names.yul new file mode 100644 index 00000000..644e9126 --- /dev/null +++ b/test/libyul/yulOptimizerTests/fullInliner/long_names.yul @@ -0,0 +1,25 @@ +{ + function verylongfunctionname(verylongvariablename) -> verylongvariablename2 { + verylongvariablename2 := add(verylongvariablename, verylongvariablename) + } + // same long name + let verylongvariablename2 := 3 + mstore(0, verylongfunctionname(verylongvariablename2)) + mstore(1, verylongvariablename2) +} +// ---- +// fullInliner +// { +// { +// let verylongvariablename2_1 := 3 +// let verylongfu_verylongvariablename := verylongvariablename2_1 +// let verylongfu_verylongvariablename2 +// verylongfu_verylongvariablename2 := add(verylongfu_verylongvariablename, verylongfu_verylongvariablename) +// mstore(0, verylongfu_verylongvariablename2) +// mstore(1, verylongvariablename2_1) +// } +// function verylongfunctionname(verylongvariablename) -> verylongvariablename2 +// { +// verylongvariablename2 := add(verylongvariablename, verylongvariablename) +// } +// } |