mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #8508 from a3d4/again-refactor-testcase-classes
More refactoring of TestCase classes
This commit is contained in:
commit
d55bbd4aa5
@ -28,7 +28,7 @@ using namespace solidity;
|
|||||||
using namespace solidity::frontend;
|
using namespace solidity::frontend;
|
||||||
using namespace solidity::frontend::test;
|
using namespace solidity::frontend::test;
|
||||||
|
|
||||||
void TestCase::printUpdatedSettings(ostream& _stream, const string& _linePrefix, const bool)
|
void TestCase::printSettings(ostream& _stream, const string& _linePrefix, const bool)
|
||||||
{
|
{
|
||||||
auto& settings = m_reader.settings();
|
auto& settings = m_reader.settings();
|
||||||
if (settings.empty())
|
if (settings.empty())
|
||||||
@ -63,11 +63,10 @@ void TestCase::expect(string::iterator& _it, string::iterator _end, string::valu
|
|||||||
EVMVersionRestrictedTestCase::EVMVersionRestrictedTestCase(string const& _filename):
|
EVMVersionRestrictedTestCase::EVMVersionRestrictedTestCase(string const& _filename):
|
||||||
TestCase(_filename)
|
TestCase(_filename)
|
||||||
{
|
{
|
||||||
if (!m_reader.hasSetting("EVMVersion"))
|
string versionString = m_reader.stringSetting("EVMVersion", "any");
|
||||||
|
if (versionString == "any")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
string versionString = m_reader.stringSetting("EVMVersion", "");
|
|
||||||
|
|
||||||
string comparator;
|
string comparator;
|
||||||
size_t versionBegin = 0;
|
size_t versionBegin = 0;
|
||||||
for (auto character: versionString)
|
for (auto character: versionString)
|
||||||
|
@ -57,8 +57,8 @@ public:
|
|||||||
/// If @arg _formatted is true, color-coding may be used to indicate
|
/// If @arg _formatted is true, color-coding may be used to indicate
|
||||||
/// error locations in the contract, if applicable.
|
/// error locations in the contract, if applicable.
|
||||||
virtual void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const = 0;
|
virtual void printSource(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) const = 0;
|
||||||
/// Outputs the updated settings.
|
/// Outputs settings.
|
||||||
virtual void printUpdatedSettings(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false);
|
virtual void printSettings(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false);
|
||||||
/// Outputs test expectations to @arg _stream that match the actual results of the test.
|
/// Outputs test expectations to @arg _stream that match the actual results of the test.
|
||||||
/// Each line of output is prefixed with @arg _linePrefix.
|
/// Each line of output is prefixed with @arg _linePrefix.
|
||||||
virtual void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const = 0;
|
virtual void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const = 0;
|
||||||
|
@ -49,14 +49,9 @@ string TestCaseReader::simpleExpectations()
|
|||||||
return parseSimpleExpectations(m_file);
|
return parseSimpleExpectations(m_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TestCaseReader::hasSetting(std::string const& _name) const
|
|
||||||
{
|
|
||||||
return m_settings.count(_name) != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TestCaseReader::boolSetting(std::string const& _name, bool _defaultValue)
|
bool TestCaseReader::boolSetting(std::string const& _name, bool _defaultValue)
|
||||||
{
|
{
|
||||||
if (!hasSetting(_name))
|
if (m_settings.count(_name) == 0)
|
||||||
return _defaultValue;
|
return _defaultValue;
|
||||||
|
|
||||||
m_unreadSettings.erase(_name);
|
m_unreadSettings.erase(_name);
|
||||||
@ -71,7 +66,7 @@ bool TestCaseReader::boolSetting(std::string const& _name, bool _defaultValue)
|
|||||||
|
|
||||||
size_t TestCaseReader::sizetSetting(std::string const& _name, size_t _defaultValue)
|
size_t TestCaseReader::sizetSetting(std::string const& _name, size_t _defaultValue)
|
||||||
{
|
{
|
||||||
if (!hasSetting(_name))
|
if (m_settings.count(_name) == 0)
|
||||||
return _defaultValue;
|
return _defaultValue;
|
||||||
|
|
||||||
m_unreadSettings.erase(_name);
|
m_unreadSettings.erase(_name);
|
||||||
@ -82,18 +77,13 @@ size_t TestCaseReader::sizetSetting(std::string const& _name, size_t _defaultVal
|
|||||||
|
|
||||||
string TestCaseReader::stringSetting(string const& _name, string const& _defaultValue)
|
string TestCaseReader::stringSetting(string const& _name, string const& _defaultValue)
|
||||||
{
|
{
|
||||||
if (!hasSetting(_name))
|
if (m_settings.count(_name) == 0)
|
||||||
return _defaultValue;
|
return _defaultValue;
|
||||||
|
|
||||||
m_unreadSettings.erase(_name);
|
m_unreadSettings.erase(_name);
|
||||||
return m_settings.at(_name);
|
return m_settings.at(_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCaseReader::setSetting(std::string const& _name, std::string const& _value)
|
|
||||||
{
|
|
||||||
m_settings[_name] = _value;
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestCaseReader::ensureAllSettingsRead() const
|
void TestCaseReader::ensureAllSettingsRead() const
|
||||||
{
|
{
|
||||||
if (!m_unreadSettings.empty())
|
if (!m_unreadSettings.empty())
|
||||||
|
@ -40,11 +40,9 @@ public:
|
|||||||
|
|
||||||
std::string simpleExpectations();
|
std::string simpleExpectations();
|
||||||
|
|
||||||
bool hasSetting(std::string const& _name) const;
|
|
||||||
bool boolSetting(std::string const& _name, bool _defaultValue);
|
bool boolSetting(std::string const& _name, bool _defaultValue);
|
||||||
size_t sizetSetting(std::string const& _name, size_t _defaultValue);
|
size_t sizetSetting(std::string const& _name, size_t _defaultValue);
|
||||||
std::string stringSetting(std::string const& _name, std::string const& _defaultValue);
|
std::string stringSetting(std::string const& _name, std::string const& _defaultValue);
|
||||||
void setSetting(std::string const& _name, std::string const& _value);
|
|
||||||
|
|
||||||
void ensureAllSettingsRead() const;
|
void ensureAllSettingsRead() const;
|
||||||
|
|
||||||
|
@ -43,21 +43,24 @@ SemanticTest::SemanticTest(string const& _filename, langutil::EVMVersion _evmVer
|
|||||||
m_source = m_reader.source();
|
m_source = m_reader.source();
|
||||||
m_lineOffset = m_reader.lineNumber();
|
m_lineOffset = m_reader.lineNumber();
|
||||||
|
|
||||||
if (m_reader.hasSetting("compileViaYul"))
|
string choice = m_reader.stringSetting("compileViaYul", "false");
|
||||||
|
if (choice == "also")
|
||||||
{
|
{
|
||||||
string choice = m_reader.stringSetting("compileViaYul", "");
|
m_runWithYul = true;
|
||||||
if (choice == "also")
|
m_runWithoutYul = true;
|
||||||
{
|
|
||||||
m_runWithYul = true;
|
|
||||||
m_runWithoutYul = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_reader.setSetting("compileViaYul", "only");
|
|
||||||
m_runWithYul = true;
|
|
||||||
m_runWithoutYul = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else if (choice == "true")
|
||||||
|
{
|
||||||
|
m_runWithYul = true;
|
||||||
|
m_runWithoutYul = false;
|
||||||
|
}
|
||||||
|
else if (choice == "false")
|
||||||
|
{
|
||||||
|
m_runWithYul = false;
|
||||||
|
m_runWithoutYul = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
BOOST_THROW_EXCEPTION(runtime_error("Invalid compileViaYul value: " + choice + "."));
|
||||||
|
|
||||||
m_runWithABIEncoderV1Only = m_reader.boolSetting("ABIEncoderV1Only", false);
|
m_runWithABIEncoderV1Only = m_reader.boolSetting("ABIEncoderV1Only", false);
|
||||||
if (m_runWithABIEncoderV1Only && solidity::test::CommonOptions::get().useABIEncoderV2)
|
if (m_runWithABIEncoderV1Only && solidity::test::CommonOptions::get().useABIEncoderV2)
|
||||||
|
@ -7,7 +7,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// compileViaYul: only
|
// compileViaYul: true
|
||||||
// ----
|
// ----
|
||||||
// f(uint256,uint256): 10, 3 -> 1
|
// f(uint256,uint256): 10, 3 -> 1
|
||||||
// f(uint256,uint256): 10, 2 -> 0
|
// f(uint256,uint256): 10, 2 -> 0
|
||||||
|
@ -7,7 +7,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// compileViaYul: only
|
// compileViaYul: true
|
||||||
// ----
|
// ----
|
||||||
// f(int256,int256): 10, 3 -> 1
|
// f(int256,int256): 10, 3 -> 1
|
||||||
// f(int256,int256): 10, 2 -> 0
|
// f(int256,int256): 10, 2 -> 0
|
||||||
|
@ -8,7 +8,7 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// compileViaYul: only
|
// compileViaYul: true
|
||||||
// ----
|
// ----
|
||||||
// keccak1() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107
|
// keccak1() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107
|
||||||
// keccak2() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107
|
// keccak2() -> 0x64e604787cbf194841e7b68d7cd28786f6c9a0a3ab9f8b0a0e87cb4387ab0107
|
||||||
|
@ -5,7 +5,7 @@ contract C {
|
|||||||
function h() external pure returns (bytes4) { return 0xcafecafe; }
|
function h() external pure returns (bytes4) { return 0xcafecafe; }
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// compileViaYul: only
|
// compileViaYul: true
|
||||||
// ----
|
// ----
|
||||||
// f1() -> 0x20, 6, left(0x616263616263)
|
// f1() -> 0x20, 6, left(0x616263616263)
|
||||||
// f2() -> 32, 47, 44048183223289766195424279195050628400112610419087780792899004030957505095210, 18165586057823232067963737336409268114628061002662705707816940456850361417728
|
// f2() -> 32, 47, 44048183223289766195424279195050628400112610419087780792899004030957505095210, 18165586057823232067963737336409268114628061002662705707816940456850361417728
|
||||||
|
@ -103,8 +103,6 @@ YulOptimizerTest::YulOptimizerTest(string const& _filename):
|
|||||||
auto dialectName = m_reader.stringSetting("dialect", "evm");
|
auto dialectName = m_reader.stringSetting("dialect", "evm");
|
||||||
m_dialect = &dialect(dialectName, solidity::test::CommonOptions::get().evmVersion());
|
m_dialect = &dialect(dialectName, solidity::test::CommonOptions::get().evmVersion());
|
||||||
|
|
||||||
m_step = m_reader.stringSetting("step", "");
|
|
||||||
|
|
||||||
m_expectation = m_reader.simpleExpectations();
|
m_expectation = m_reader.simpleExpectations();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,21 +350,8 @@ TestCase::TestResult YulOptimizerTest::run(ostream& _stream, string const& _line
|
|||||||
return TestResult::FatalError;
|
return TestResult::FatalError;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_obtainedResult = AsmPrinter{*m_dialect}(*m_ast) + "\n";
|
m_obtainedResult = "step: " + m_optimizerStep + "\n\n" + AsmPrinter{ *m_dialect }(*m_ast) + "\n";
|
||||||
|
|
||||||
if (m_optimizerStep != m_step)
|
|
||||||
{
|
|
||||||
string nextIndentLevel = _linePrefix + " ";
|
|
||||||
AnsiColorized(_stream, _formatted, {formatting::BOLD, formatting::CYAN}) <<
|
|
||||||
_linePrefix <<
|
|
||||||
"Invalid optimizer step. Given: \"" <<
|
|
||||||
m_step <<
|
|
||||||
"\", should be: \"" <<
|
|
||||||
m_optimizerStep <<
|
|
||||||
"\"." <<
|
|
||||||
endl;
|
|
||||||
return TestResult::FatalError;
|
|
||||||
}
|
|
||||||
if (m_expectation != m_obtainedResult)
|
if (m_expectation != m_obtainedResult)
|
||||||
{
|
{
|
||||||
string nextIndentLevel = _linePrefix + " ";
|
string nextIndentLevel = _linePrefix + " ";
|
||||||
@ -385,13 +370,6 @@ void YulOptimizerTest::printSource(ostream& _stream, string const& _linePrefix,
|
|||||||
printIndented(_stream, m_source, _linePrefix);
|
printIndented(_stream, m_source, _linePrefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
void YulOptimizerTest::printUpdatedSettings(ostream& _stream, const string& _linePrefix, const bool _formatted)
|
|
||||||
{
|
|
||||||
m_step = m_optimizerStep;
|
|
||||||
m_reader.setSetting("step", m_step);
|
|
||||||
EVMVersionRestrictedTestCase::printUpdatedSettings(_stream, _linePrefix, _formatted);
|
|
||||||
}
|
|
||||||
|
|
||||||
void YulOptimizerTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const
|
void YulOptimizerTest::printUpdatedExpectations(ostream& _stream, string const& _linePrefix) const
|
||||||
{
|
{
|
||||||
printIndented(_stream, m_obtainedResult, _linePrefix);
|
printIndented(_stream, m_obtainedResult, _linePrefix);
|
||||||
|
@ -57,7 +57,6 @@ public:
|
|||||||
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
TestResult run(std::ostream& _stream, std::string const& _linePrefix = "", bool const _formatted = false) override;
|
||||||
|
|
||||||
void printSource(std::ostream& _stream, std::string const &_linePrefix = "", bool const _formatted = false) const override;
|
void printSource(std::ostream& _stream, std::string const &_linePrefix = "", bool const _formatted = false) const override;
|
||||||
void printUpdatedSettings(std::ostream &_stream, std::string const &_linePrefix = "", bool const _formatted = false) override;
|
|
||||||
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
void printUpdatedExpectations(std::ostream& _stream, std::string const& _linePrefix) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -73,7 +72,6 @@ private:
|
|||||||
std::string m_expectation;
|
std::string m_expectation;
|
||||||
|
|
||||||
Dialect const* m_dialect = nullptr;
|
Dialect const* m_dialect = nullptr;
|
||||||
std::string m_step;
|
|
||||||
std::set<YulString> m_reservedIdentifiers;
|
std::set<YulString> m_reservedIdentifiers;
|
||||||
std::unique_ptr<NameDispenser> m_nameDispenser;
|
std::unique_ptr<NameDispenser> m_nameDispenser;
|
||||||
std::unique_ptr<OptimiserStepContext> m_context;
|
std::unique_ptr<OptimiserStepContext> m_context;
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
}
|
}
|
||||||
let z := mload(2)
|
let z := mload(2)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: blockFlattener
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: blockFlattener
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let _1 := mload(0)
|
// let _1 := mload(0)
|
||||||
// let f_a := mload(1)
|
// let f_a := mload(1)
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
a := add(a, 1)
|
a := add(a, 1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: blockFlattener
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: blockFlattener
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) }
|
// for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) }
|
||||||
// { a := add(a, 1) }
|
// { a := add(a, 1) }
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
}
|
}
|
||||||
let t := add(3, 9)
|
let t := add(3, 9)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: blockFlattener
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: blockFlattener
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// if add(mload(7), sload(mload(3)))
|
// if add(mload(7), sload(mload(3)))
|
||||||
// {
|
// {
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
a := add(a, c)
|
a := add(a, c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: blockFlattener
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: blockFlattener
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 3
|
// let a := 3
|
||||||
// let b := 4
|
// let b := 4
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
default { a := 3 { a := 4 } }
|
default { a := 3 { a := 4 } }
|
||||||
a := 5
|
a := 5
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: blockFlattener
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: blockFlattener
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 1
|
// let a := 1
|
||||||
// switch calldataload(0)
|
// switch calldataload(0)
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
function h() -> z { z := g() }
|
function h() -> z { z := g() }
|
||||||
a := h()
|
a := h()
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: circularReferencesPruner
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: circularReferencesPruner
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a
|
// let a
|
||||||
// a := h()
|
// a := h()
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
function d() -> w { w := c() }
|
function d() -> w { w := c() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: circularReferencesPruner
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: circularReferencesPruner
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
function y() -> x { x := z() }
|
function y() -> x { x := z() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: circularReferencesPruner
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: circularReferencesPruner
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
function f() -> x { x := g() }
|
function f() -> x { x := g() }
|
||||||
function g() -> x { x := f() }
|
function g() -> x { x := f() }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: circularReferencesPruner
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: circularReferencesPruner
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
}
|
}
|
||||||
mstore(1, codesize())
|
mstore(1, codesize())
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 1
|
// let a := 1
|
||||||
// let b := codesize()
|
// let b := codesize()
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
if b { b := 1 }
|
if b { b := 1 }
|
||||||
let c := 1
|
let c := 1
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let b := 1
|
// let b := 1
|
||||||
// if b { b := b }
|
// if b { b := b }
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
p_1 := add(array, _22)
|
p_1 := add(array, _22)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let _13 := 0x20
|
// let _13 := 0x20
|
||||||
// let _14 := allocate(_13)
|
// let _14 := allocate(_13)
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
a := 9
|
a := 9
|
||||||
sstore(x, 3)
|
sstore(x, 3)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := calldataload(0)
|
// let a := calldataload(0)
|
||||||
// let x := calldataload(0x20)
|
// let x := calldataload(0x20)
|
||||||
|
@ -23,9 +23,9 @@
|
|||||||
let _11 := array_index_access(x, _10)
|
let _11 := array_index_access(x, _10)
|
||||||
mstore(_11, _9)
|
mstore(_11, _9)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// function allocate(size) -> p
|
// function allocate(size) -> p
|
||||||
// {
|
// {
|
||||||
|
@ -35,9 +35,9 @@
|
|||||||
}
|
}
|
||||||
sstore(_1, sum_50)
|
sstore(_1, sum_50)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let _1 := 0
|
// let _1 := 0
|
||||||
// let _33 := calldataload(_1)
|
// let _33 := calldataload(_1)
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
let c := double_with_se(i)
|
let c := double_with_se(i)
|
||||||
let d := double_with_se(i)
|
let d := double_with_se(i)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// function double(x) -> y
|
// function double(x) -> y
|
||||||
// { y := add(x, x) }
|
// { y := add(x, x) }
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
let a := mload(1)
|
let a := mload(1)
|
||||||
let b := mload(1)
|
let b := mload(1)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := mload(1)
|
// let a := mload(1)
|
||||||
// let b := mload(1)
|
// let b := mload(1)
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
let a := gas()
|
let a := gas()
|
||||||
let b := gas()
|
let b := gas()
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := gas()
|
// let a := gas()
|
||||||
// let b := gas()
|
// let b := gas()
|
||||||
|
@ -14,9 +14,9 @@ object "main" {
|
|||||||
}
|
}
|
||||||
data "abc" "Hello, World!"
|
data "abc" "Hello, World!"
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let r := "abc"
|
// let r := "abc"
|
||||||
// let a := datasize("abc")
|
// let a := datasize("abc")
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
mstore(0, calldataload(0))
|
mstore(0, calldataload(0))
|
||||||
mstore(0, x)
|
mstore(0, x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 10
|
// let a := 10
|
||||||
// let x := 20
|
// let x := 20
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ }
|
{ }
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
let a := mul(1, codesize())
|
let a := mul(1, codesize())
|
||||||
let b := mul(1, codesize())
|
let b := mul(1, codesize())
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := mul(1, codesize())
|
// let a := mul(1, codesize())
|
||||||
// let b := a
|
// let b := a
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
let b := 0
|
let b := 0
|
||||||
sstore(a, b)
|
sstore(a, b)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// function f() -> x
|
// function f() -> x
|
||||||
// {
|
// {
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
let b
|
let b
|
||||||
mstore(sub(a, b), 7)
|
mstore(sub(a, b), 7)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a
|
// let a
|
||||||
// let b
|
// let b
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
a := b
|
a := b
|
||||||
mstore(2, a)
|
mstore(2, a)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: commonSubexpressionEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: commonSubexpressionEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := mload(0)
|
// let a := mload(0)
|
||||||
// let b := add(a, 7)
|
// let b := add(a, 7)
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y:bool := false
|
// let y:bool := false
|
||||||
// for { } true { }
|
// for { } true { }
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// dialect: ewasm
|
// dialect: ewasm
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y:i32 := 0:i32
|
// let y:i32 := 0:i32
|
||||||
// for { } true { }
|
// for { } true { }
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
if y { break }
|
if y { break }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := mload(0x20)
|
// let y := mload(0x20)
|
||||||
// for { } and(y, 8) { pop(y) }
|
// for { } and(y, 8) { pop(y) }
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
if y { continue }
|
if y { continue }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := mload(0x20)
|
// let y := mload(0x20)
|
||||||
// for { } and(y, 8) { pop(y) }
|
// for { } and(y, 8) { pop(y) }
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
x := 2
|
x := 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// let y := mload(0)
|
// let y := mload(0)
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
}
|
}
|
||||||
sstore(0, x)
|
sstore(0, x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x
|
// let x
|
||||||
// for { } x { sstore(1, x) }
|
// for { } x { sstore(1, x) }
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
sstore(10, x)
|
sstore(10, x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// for { } 1 { }
|
// for { } 1 { }
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
if x { sstore(0, x) }
|
if x { sstore(0, x) }
|
||||||
sstore(1, x)
|
sstore(1, x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// if x { sstore(0, x) }
|
// if x { sstore(0, x) }
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
if x { sstore(0, x) revert(0, 0) }
|
if x { sstore(0, x) revert(0, 0) }
|
||||||
sstore(1, x)
|
sstore(1, x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// if x
|
// if x
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
pop(x)
|
pop(x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := calldataload(0)
|
// let x := calldataload(0)
|
||||||
// switch x
|
// switch x
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ }
|
{ }
|
||||||
// ====
|
|
||||||
// step: conditionalSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalSimplifier
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
y := 0
|
y := 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := mload(0x20)
|
// let y := mload(0x20)
|
||||||
// for { } and(y, 8) { pop(y) }
|
// for { } and(y, 8) { pop(y) }
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
y := 0
|
y := 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := mload(0x20)
|
// let y := mload(0x20)
|
||||||
// for { } and(y, 8) { pop(y) }
|
// for { } and(y, 8) { pop(y) }
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
x := 2
|
x := 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// let y := mload(0)
|
// let y := mload(0)
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
}
|
}
|
||||||
sstore(0, x)
|
sstore(0, x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x
|
// let x
|
||||||
// for { } x { sstore(1, x) }
|
// for { } x { sstore(1, x) }
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
sstore(10, x)
|
sstore(10, x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// for { } 1 { }
|
// for { } 1 { }
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
x := 0
|
x := 0
|
||||||
sstore(1, x)
|
sstore(1, x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// if x { sstore(0, x) }
|
// if x { sstore(0, x) }
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
x := 0
|
x := 0
|
||||||
sstore(1, x)
|
sstore(1, x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := mload(0)
|
// let x := mload(0)
|
||||||
// if x
|
// if x
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
pop(x)
|
pop(x)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := calldataload(0)
|
// let x := calldataload(0)
|
||||||
// switch x
|
// switch x
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ }
|
{ }
|
||||||
// ====
|
|
||||||
// step: conditionalUnsimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: conditionalUnsimplifier
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
let z := 0xffff0000ffff0000ffff0000ffff0000ff00ff00ffff0000ffff0000ffff0000
|
let z := 0xffff0000ffff0000ffff0000ffff0000ff00ff00ffff0000ffff0000ffff0000
|
||||||
let w := 0xffffffff000000ffffef000001feff000067ffefff0000ff230002ffee00fff7
|
let w := 0xffffffff000000ffffef000001feff000067ffefff0000ff230002ffee00fff7
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: constantOptimiser
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: constantOptimiser
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := 0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00
|
// let x := 0xff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00ff00
|
||||||
// let y := 0x1100ff00ff00ff001100ff00ff001100ff00ff001100ff00ff001100ff001100
|
// let y := 0x1100ff00ff00ff001100ff00ff001100ff00ff001100ff00ff001100ff001100
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >=constantinople
|
// EVMVersion: >=constantinople
|
||||||
// step: constantOptimiser
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: constantOptimiser
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := shl(172, 1)
|
// let a := shl(172, 1)
|
||||||
// let x := add(shl(248, 17), 0xffffffffffffffffffffffff23)
|
// let x := add(shl(248, 17), 0xffffffffffffffffffffffff23)
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
for { let i := 0xff00 } lt(i, 2) { i := add(i, 3) } {
|
for { let i := 0xff00 } lt(i, 2) { i := add(i, 3) } {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: constantOptimiser
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: constantOptimiser
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let x := 8
|
// let x := 8
|
||||||
// let y := 0xffff
|
// let y := 0xffff
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{ let a := mload(0) if a {} }
|
{ let a := mload(0) if a {} }
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := mload(0)
|
// let a := mload(0)
|
||||||
// pop(a)
|
// pop(a)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ if mload(0) {} }
|
{ if mload(0) {} }
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// { pop(mload(0)) }
|
// { pop(mload(0)) }
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
function g() -> x { leave x := 7 }
|
function g() -> x { leave x := 7 }
|
||||||
function h() -> x { if x { leave } }
|
function h() -> x { if x { leave } }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// function f() -> x
|
// function f() -> x
|
||||||
// { x := 7 }
|
// { x := 7 }
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
switch mload(0) default { mstore(1, 2) }
|
switch mload(0) default { mstore(1, 2) }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// pop(mload(0))
|
// pop(mload(0))
|
||||||
// { mstore(1, 2) }
|
// { mstore(1, 2) }
|
||||||
|
@ -10,9 +10,9 @@
|
|||||||
case 1 { }
|
case 1 { }
|
||||||
default { }
|
default { }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
||||||
// pop(add(y, 4))
|
// pop(add(y, 4))
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
case 1 { y := 9 }
|
case 1 { y := 9 }
|
||||||
case 2 { y := 10 }
|
case 2 { y := 10 }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
||||||
// switch calldataload(0)
|
// switch calldataload(0)
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
case 1 { y := 9 }
|
case 1 { y := 9 }
|
||||||
default { }
|
default { }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
||||||
// if eq(1, calldataload(0)) { y := 9 }
|
// if eq(1, calldataload(0)) { y := 9 }
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
case 2 { y := 10 }
|
case 2 { y := 10 }
|
||||||
default { }
|
default { }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := 200
|
// let y := 200
|
||||||
// switch calldataload(0)
|
// switch calldataload(0)
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
switch calldataload(0) case 2 { mstore(0, 0) }
|
switch calldataload(0) case 2 { mstore(0, 0) }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// if eq(2, calldataload(0)) { mstore(0, 0) }
|
// if eq(2, calldataload(0)) { mstore(0, 0) }
|
||||||
// }
|
// }
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// if calldatasize() { mstore(4, 5) }
|
// if calldatasize() { mstore(4, 5) }
|
||||||
// }
|
// }
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// for { } calldatasize() { mstore(8, 9) }
|
// for { } calldatasize() { mstore(8, 9) }
|
||||||
// {
|
// {
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// if calldatasize()
|
// if calldatasize()
|
||||||
// {
|
// {
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
revert(0, x)
|
revert(0, x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// if calldatasize()
|
// if calldatasize()
|
||||||
// {
|
// {
|
||||||
|
@ -6,9 +6,9 @@
|
|||||||
revert(0, x)
|
revert(0, x)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// for { } calldatasize() { mstore(1, 2) }
|
// for { } calldatasize() { mstore(1, 2) }
|
||||||
// {
|
// {
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: controlFlowSimplifier
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: controlFlowSimplifier
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// for { } calldatasize() { mstore(1, 2) }
|
// for { } calldatasize() { mstore(1, 2) }
|
||||||
// {
|
// {
|
||||||
|
@ -13,9 +13,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 20
|
// let a := 20
|
||||||
// for { } lt(a, 40) { a := add(a, 2) }
|
// for { } lt(a, 40) { a := add(a, 2) }
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 20
|
// let a := 20
|
||||||
// for { } lt(a, 40) { a := add(a, 2) }
|
// for { } lt(a, 40) { a := add(a, 2) }
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 20
|
// let a := 20
|
||||||
// for { } lt(a, 40) { a := add(a, 2) }
|
// for { } lt(a, 40) { a := add(a, 2) }
|
||||||
|
@ -18,9 +18,9 @@
|
|||||||
pop(f())
|
pop(f())
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// function f() -> x
|
// function f() -> x
|
||||||
// {
|
// {
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let b := 20
|
// let b := 20
|
||||||
// revert(0, 0)
|
// revert(0, 0)
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let b := 20
|
// let b := 20
|
||||||
// stop()
|
// stop()
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
let i_1 := i_0
|
let i_1 := i_0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// { stop() }
|
// { stop() }
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
|
|
||||||
pop(add(1, 1))
|
pop(add(1, 1))
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// fun()
|
// fun()
|
||||||
// revert(0, 0)
|
// revert(0, 0)
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
y := 10 }
|
y := 10 }
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let y := mload(0)
|
// let y := mload(0)
|
||||||
// switch y
|
// switch y
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
}
|
}
|
||||||
mstore(0, 0)
|
mstore(0, 0)
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// { revert(0, 0) }
|
// { revert(0, 0) }
|
||||||
// mstore(0, 0)
|
// mstore(0, 0)
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 20
|
// let a := 20
|
||||||
// for { } lt(a, 40) { a := add(a, 2) }
|
// for { } lt(a, 40) { a := add(a, 2) }
|
||||||
|
@ -12,9 +12,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let a := 20
|
// let a := 20
|
||||||
// for { } lt(a, 40) { a := add(a, 2) }
|
// for { } lt(a, 40) { a := add(a, 2) }
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
stop()
|
stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ====
|
|
||||||
// step: deadCodeEliminator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: deadCodeEliminator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// let b := 20
|
// let b := 20
|
||||||
// let a := 20
|
// let a := 20
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// { let a, b }
|
// { let a, b }
|
||||||
// {
|
// {
|
||||||
|
@ -8,8 +8,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// { let a, b, c, d, f }
|
// { let a, b, c, d, f }
|
||||||
// {
|
// {
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// { let a, b, c }
|
// { let a, b, c }
|
||||||
// {
|
// {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{ { let aanteuhdaoneudbrgkjiuaothduiathudaoeuh:u256 } { let aanteuhdaoneudbrgkjiuaothduiathudaoeuh:u256 } }
|
{ { let aanteuhdaoneudbrgkjiuaothduiathudaoeuh:u256 } { let aanteuhdaoneudbrgkjiuaothduiathudaoeuh:u256 } }
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// {
|
// {
|
||||||
// let aanteuhdaoneudbrgkjiuaothduiathudaoeuh
|
// let aanteuhdaoneudbrgkjiuaothduiathudaoeuh
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
{ }
|
{ }
|
||||||
// ====
|
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
{ }
|
{ }
|
||||||
// ====
|
// ====
|
||||||
// step: disambiguator
|
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// { }
|
// { }
|
||||||
|
@ -9,8 +9,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// { let a, b, c }
|
// { let a, b, c }
|
||||||
// {
|
// {
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{ { let a:u256 } { let a:u256 } }
|
{ { let a:u256 } { let a:u256 } }
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// { let a }
|
// { let a }
|
||||||
// { let a_1 }
|
// { let a_1 }
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
{ { let a:u256 let a_1:u256 } { let a:u256 } }
|
{ { let a:u256 let a_1:u256 } { let a:u256 } }
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// {
|
// {
|
||||||
// let a
|
// let a
|
||||||
|
@ -7,8 +7,9 @@
|
|||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// dialect: yul
|
// dialect: yul
|
||||||
// step: disambiguator
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: disambiguator
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// {
|
// {
|
||||||
// let c
|
// let c
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: equivalentFunctionCombiner
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: equivalentFunctionCombiner
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// pop(f(1, 2, 3))
|
// pop(f(1, 2, 3))
|
||||||
// pop(f(4, 5, 6))
|
// pop(f(4, 5, 6))
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
function f() { mstore(1, mload(0)) }
|
function f() { mstore(1, mload(0)) }
|
||||||
function g() { mstore(1, mload(0)) }
|
function g() { mstore(1, mload(0)) }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: equivalentFunctionCombiner
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: equivalentFunctionCombiner
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// f()
|
// f()
|
||||||
// f()
|
// f()
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
function f() -> b { let a := mload(0) b := a }
|
function f() -> b { let a := mload(0) b := a }
|
||||||
function g() -> a { let b := mload(0) a := b }
|
function g() -> a { let b := mload(0) a := b }
|
||||||
}
|
}
|
||||||
// ====
|
|
||||||
// step: equivalentFunctionCombiner
|
|
||||||
// ----
|
// ----
|
||||||
|
// step: equivalentFunctionCombiner
|
||||||
|
//
|
||||||
// {
|
// {
|
||||||
// pop(f())
|
// pop(f())
|
||||||
// pop(f())
|
// pop(f())
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user