diff --git a/scripts/tests.sh b/scripts/tests.sh index 3e970ee43..120dbd997 100755 --- a/scripts/tests.sh +++ b/scripts/tests.sh @@ -203,7 +203,7 @@ do force_abiv2_flag="" if [[ "$abiv2" == "yes" ]] then - force_abiv2_flag="--abiencoderv2" + force_abiv2_flag="--abiencoderv2 --optimize-yul" fi printTask "--> Running tests using "$optimize" --evm-version "$vm" $force_abiv2_flag..." diff --git a/test/Common.h b/test/Common.h index f16646daa..12f2dacef 100644 --- a/test/Common.h +++ b/test/Common.h @@ -37,6 +37,7 @@ struct CommonOptions: boost::noncopyable boost::filesystem::path ipcPath; boost::filesystem::path testPath; bool optimize = false; + bool optimizeYul = false; bool disableIPC = false; bool disableSMT = false; diff --git a/test/ExecutionFramework.cpp b/test/ExecutionFramework.cpp index eeac68be2..7b4397e63 100644 --- a/test/ExecutionFramework.cpp +++ b/test/ExecutionFramework.cpp @@ -57,10 +57,14 @@ ExecutionFramework::ExecutionFramework(): ExecutionFramework::ExecutionFramework(string const& _ipcPath, langutil::EVMVersion _evmVersion): m_rpc(RPCSession::instance(_ipcPath)), m_evmVersion(_evmVersion), - m_optimiserSettings(dev::test::Options::get().optimize ? solidity::OptimiserSettings::standard() : solidity::OptimiserSettings::minimal()), + m_optimiserSettings(solidity::OptimiserSettings::minimal()), m_showMessages(dev::test::Options::get().showMessages), m_sender(m_rpc.account(0)) { + if (dev::test::Options::get().optimizeYul) + m_optimiserSettings = solidity::OptimiserSettings::full(); + else if (dev::test::Options::get().optimize) + m_optimiserSettings = solidity::OptimiserSettings::standard(); m_rpc.test_rewindToBlock(0); } diff --git a/test/Options.cpp b/test/Options.cpp index 26a83d16f..3294dad1e 100644 --- a/test/Options.cpp +++ b/test/Options.cpp @@ -52,6 +52,7 @@ Options::Options() options.add_options() ("optimize", po::bool_switch(&optimize), "enables optimization") + ("optimize-yul", po::bool_switch(&optimizeYul), "enables Yul optimization") ("abiencoderv2", po::bool_switch(&useABIEncoderV2), "enables abi encoder v2") ("show-messages", po::bool_switch(&showMessages), "enables message output"); diff --git a/test/libsolidity/GasCosts.cpp b/test/libsolidity/GasCosts.cpp index 9970d0454..1e7858a51 100644 --- a/test/libsolidity/GasCosts.cpp +++ b/test/libsolidity/GasCosts.cpp @@ -72,7 +72,12 @@ BOOST_AUTO_TEST_CASE(string_storage) CHECK_GAS(133899, 130591, 100); // This is only correct on >=Constantinople. else if (Options::get().useABIEncoderV2) - CHECK_GAS(151283, 136003, 100); + { + if (Options::get().optimizeYul) + CHECK_GAS(151283, 128285, 100); + else + CHECK_GAS(151283, 136003, 100); + } else CHECK_GAS(126689, 120159, 100); if (Options::get().evmVersion() >= EVMVersion::byzantium()) @@ -82,7 +87,12 @@ BOOST_AUTO_TEST_CASE(string_storage) CHECK_GAS(21551, 21526, 20); // This is only correct on >=Constantinople. else if (Options::get().useABIEncoderV2) - CHECK_GAS(21713, 21635, 20); + { + if (Options::get().optimizeYul) + CHECK_GAS(21713, 21567, 20); + else + CHECK_GAS(21713, 21635, 20); + } else CHECK_GAS(21546, 21526, 20); }