From 8e9496eb8bef165797b7c7dd73fda76893049c66 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Mon, 13 Sep 2021 20:37:16 +0200 Subject: [PATCH 1/7] Change semantic tests to use the proper via IR pipeline, without rerunning on exceptions --- .../SolidityExecutionFramework.cpp | 50 ++----------------- 1 file changed, 5 insertions(+), 45 deletions(-) diff --git a/test/libsolidity/SolidityExecutionFramework.cpp b/test/libsolidity/SolidityExecutionFramework.cpp index 7b79def1e..c8ec18088 100644 --- a/test/libsolidity/SolidityExecutionFramework.cpp +++ b/test/libsolidity/SolidityExecutionFramework.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -60,13 +61,14 @@ bytes SolidityExecutionFramework::multiSourceCompileContract( m_compiler.setEVMVersion(m_evmVersion); m_compiler.setEOFVersion(m_eofVersion); m_compiler.setOptimiserSettings(m_optimiserSettings); - m_compiler.enableEvmBytecodeGeneration(!m_compileViaYul); - m_compiler.enableIRGeneration(m_compileViaYul); + m_compiler.enableEvmBytecodeGeneration(true); + m_compiler.setViaIR(m_compileViaYul); m_compiler.setRevertStringBehaviour(m_revertStrings); if (!m_appendCBORMetadata) { m_compiler.setMetadataFormat(CompilerStack::MetadataFormat::NoMetadata); } m_compiler.setMetadataHash(m_metadataHash); + if (!m_compiler.compile()) { // The testing framework expects an exception for @@ -80,49 +82,7 @@ bytes SolidityExecutionFramework::multiSourceCompileContract( BOOST_ERROR("Compiling contract failed"); } string contractName(_contractName.empty() ? m_compiler.lastContractName(_mainSourceName) : _contractName); - evmasm::LinkerObject obj; - if (m_compileViaYul) - { - // Try compiling twice: If the first run fails due to stack errors, forcefully enable - // the optimizer. - for (bool forceEnableOptimizer: {false, true}) - { - OptimiserSettings optimiserSettings = m_optimiserSettings; - if (!forceEnableOptimizer && !optimiserSettings.runYulOptimiser) - { - // Enable some optimizations on the first run - optimiserSettings.runYulOptimiser = true; - optimiserSettings.yulOptimiserSteps = "uljmul jmul"; - } - else if (forceEnableOptimizer) - optimiserSettings = OptimiserSettings::full(); - - yul::YulStack asmStack( - m_evmVersion, - m_eofVersion, - yul::YulStack::Language::StrictAssembly, - optimiserSettings, - DebugInfoSelection::All() - ); - bool analysisSuccessful = asmStack.parseAndAnalyze("", m_compiler.yulIROptimized(contractName)); - solAssert(analysisSuccessful, "Code that passed analysis in CompilerStack can't have errors"); - - try - { - asmStack.optimize(); - obj = std::move(*asmStack.assemble(yul::YulStack::Machine::EVM).bytecode); - obj.link(_libraryAddresses); - break; - } - catch (...) - { - if (forceEnableOptimizer || optimiserSettings == OptimiserSettings::full()) - throw; - } - } - } - else - obj = m_compiler.object(contractName); + evmasm::LinkerObject obj = m_compiler.object(contractName); BOOST_REQUIRE(obj.linkReferences.empty()); if (m_showMetadata) cout << "metadata: " << m_compiler.metadata(contractName) << endl; From bc6d10f11d2594465edf77e9fa60976ea1b3d00a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 22 Aug 2023 20:00:00 +0200 Subject: [PATCH 2/7] SemanticTest: Add a setting that explicitly states the minimal Yul optimization level that avoids "Stack too deep" --- test/libsolidity/SemanticTest.cpp | 103 ++++++++++++++++++++++++++++-- test/libsolidity/SemanticTest.h | 25 +++++++- 2 files changed, 123 insertions(+), 5 deletions(-) diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index 50f2a3cf1..c33ceecea 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -45,6 +45,17 @@ using namespace boost::algorithm; using namespace boost::unit_test; namespace fs = boost::filesystem; +ostream& solidity::frontend::test::operator<<(ostream& _output, RequiresYulOptimizer _requiresYulOptimizer) +{ + switch (_requiresYulOptimizer) + { + case RequiresYulOptimizer::False: _output << "false"; break; + case RequiresYulOptimizer::MinimalStack: _output << "minimalStack"; break; + case RequiresYulOptimizer::Full: _output << "full"; break; + } + return _output; +} + SemanticTest::SemanticTest( string const& _filename, langutil::EVMVersion _evmVersion, @@ -66,6 +77,16 @@ SemanticTest::SemanticTest( static set const yulRunTriggers{"also", "true"}; static set const legacyRunTriggers{"also", "false", "default"}; + m_requiresYulOptimizer = m_reader.enumSetting( + "requiresYulOptimizer", + { + {toString(RequiresYulOptimizer::False), RequiresYulOptimizer::False}, + {toString(RequiresYulOptimizer::MinimalStack), RequiresYulOptimizer::MinimalStack}, + {toString(RequiresYulOptimizer::Full), RequiresYulOptimizer::Full}, + }, + toString(RequiresYulOptimizer::False) + ); + m_runWithABIEncoderV1Only = m_reader.boolSetting("ABIEncoderV1Only", false); if (m_runWithABIEncoderV1Only && !solidity::test::CommonOptions::get().useABIEncoderV1) m_shouldRun = false; @@ -272,15 +293,38 @@ optional SemanticTest::matchEvent(util::h256 const& has return result; } +frontend::OptimiserSettings SemanticTest::optimizerSettingsFor(RequiresYulOptimizer _requiresYulOptimizer) +{ + switch (_requiresYulOptimizer) { + case RequiresYulOptimizer::False: + return OptimiserSettings::minimal(); + case RequiresYulOptimizer::MinimalStack: + { + OptimiserSettings settings = OptimiserSettings::minimal(); + settings.runYulOptimiser = true; + settings.yulOptimiserSteps = "uljmul jmul"; + return settings; + } + case RequiresYulOptimizer::Full: + return OptimiserSettings::full(); + } + unreachable(); +} + TestCase::TestResult SemanticTest::run(ostream& _stream, string const& _linePrefix, bool _formatted) { TestResult result = TestResult::Success; if (m_testCaseWantsLegacyRun && !m_eofVersion.has_value()) - result = runTest(_stream, _linePrefix, _formatted, false); + result = runTest(_stream, _linePrefix, _formatted, false /* _isYulRun */); if (m_testCaseWantsYulRun && result == TestResult::Success) - result = runTest(_stream, _linePrefix, _formatted, true); + { + if (solidity::test::CommonOptions::get().optimize) + result = runTest(_stream, _linePrefix, _formatted, true /* _isYulRun */); + else + result = tryRunTestWithYulOptimizer(_stream, _linePrefix, _formatted); + } if (result != TestResult::Success) solidity::test::CommonOptions::get().printSelectedOptions( @@ -296,7 +340,8 @@ TestCase::TestResult SemanticTest::runTest( ostream& _stream, string const& _linePrefix, bool _formatted, - bool _isYulRun) + bool _isYulRun +) { bool success = true; m_gasCostFailure = false; @@ -470,6 +515,53 @@ TestCase::TestResult SemanticTest::runTest( return TestResult::Success; } +TestCase::TestResult SemanticTest::tryRunTestWithYulOptimizer( + std::ostream& _stream, + std::string const& _linePrefix, + bool _formatted +) +{ + TestResult result{}; + for (auto requiresYulOptimizer: { + RequiresYulOptimizer::False, + RequiresYulOptimizer::MinimalStack, + RequiresYulOptimizer::Full, + }) + { + ScopedSaveAndRestore optimizerSettings( + m_optimiserSettings, + optimizerSettingsFor(requiresYulOptimizer) + ); + + try + { + result = runTest(_stream, _linePrefix, _formatted, true /* _isYulRun */); + } + catch (yul::StackTooDeepError const&) + { + if (requiresYulOptimizer == RequiresYulOptimizer::Full) + throw; + else + continue; + } + + if (m_requiresYulOptimizer != requiresYulOptimizer && result != TestResult::FatalError) + { + soltestAssert(result == TestResult::Success || result == TestResult::Failure); + + AnsiColorized(_stream, _formatted, {BOLD, YELLOW}) + << _linePrefix << endl + << _linePrefix << "requiresYulOptimizer is set to " << m_requiresYulOptimizer + << " but should be " << requiresYulOptimizer << endl; + m_requiresYulOptimizer = requiresYulOptimizer; + return TestResult::Failure; + } + + return result; + } + unreachable(); +} + bool SemanticTest::checkGasCostExpectation(TestFunctionCall& io_test, bool _compileViaYul) const { string setting = @@ -581,7 +673,10 @@ void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePre _stream << _linePrefix << "// ====" << endl; for (auto const& [settingName, settingValue]: settings) - _stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl; + if (settingName == "requiresYulOptimizer") + _stream << _linePrefix << "// " << settingName << ": " << m_requiresYulOptimizer << endl; + else + _stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl; } void SemanticTest::parseExpectations(istream& _stream) diff --git a/test/libsolidity/SemanticTest.h b/test/libsolidity/SemanticTest.h index b5b7be83a..efc2b5903 100644 --- a/test/libsolidity/SemanticTest.h +++ b/test/libsolidity/SemanticTest.h @@ -37,6 +37,15 @@ struct AnnotatedEventSignature std::vector nonIndexedTypes; }; +enum class RequiresYulOptimizer +{ + False, + MinimalStack, + Full, +}; + +std::ostream& operator<<(std::ostream& _output, RequiresYulOptimizer _requiresYulOptimizer); + /** * Class that represents a semantic test (or end-to-end test) and allows running it as part of the * boost unit test environment or isoltest. It reads the Solidity source and an additional comment @@ -83,13 +92,26 @@ public: bool deploy(std::string const& _contractName, u256 const& _value, bytes const& _arguments, std::map const& _libraries = {}); private: - TestResult runTest(std::ostream& _stream, std::string const& _linePrefix, bool _formatted, bool _isYulRun); + TestResult runTest( + std::ostream& _stream, + std::string const& _linePrefix, + bool _formatted, + bool _isYulRun + ); + TestResult tryRunTestWithYulOptimizer( + std::ostream& _stream, + std::string const& _linePrefix, + bool _formatted + ); bool checkGasCostExpectation(TestFunctionCall& io_test, bool _compileViaYul) const; std::map makeBuiltins(); std::vector makeSideEffectHooks() const; std::vector eventSideEffectHook(FunctionCall const&) const; std::optional matchEvent(util::h256 const& hash) const; static std::string formatEventParameter(std::optional _signature, bool _indexed, size_t _index, bytes const& _data); + + OptimiserSettings optimizerSettingsFor(RequiresYulOptimizer _requiresYulOptimizer); + SourceMap m_sources; std::size_t m_lineOffset; std::vector m_tests; @@ -101,6 +123,7 @@ private: bool m_allowNonExistingFunctions = false; bool m_gasCostFailure = false; bool m_enforceGasCost = false; + RequiresYulOptimizer m_requiresYulOptimizer{}; u256 m_enforceGasCostMinValue; }; From b9db435684416bf9c1007dba479378cf25e84aef Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 14 Sep 2021 16:58:40 +0200 Subject: [PATCH 3/7] Rerun SolidityEndToEndTest.cpp tests on stack errors. --- test/libsolidity/SolidityEndToEndTest.cpp | 34 +++++++++++++++++------ 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index b174419d2..c6304b727 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -35,6 +35,8 @@ #include #include +#include + #include #include @@ -51,16 +53,32 @@ using namespace solidity::util; using namespace solidity::test; using namespace solidity::langutil; -#define ALSO_VIA_YUL(CODE) \ -{ \ - m_compileViaYul = false; \ - { CODE } \ - \ - m_compileViaYul = true; \ - reset(); \ - { CODE } \ +#define ALSO_VIA_YUL(CODE) \ +{ \ + m_compileViaYul = false; \ + RUN_AND_RERUN_WITH_OPTIMIZER_ON_STACK_ERROR(CODE) \ + \ + m_compileViaYul = true; \ + reset(); \ + RUN_AND_RERUN_WITH_OPTIMIZER_ON_STACK_ERROR(CODE) \ } +#define RUN_AND_RERUN_WITH_OPTIMIZER_ON_STACK_ERROR(CODE) \ +{ \ + try \ + { CODE } \ + catch (yul::StackTooDeepError const&) \ + { \ + if (m_optimiserSettings == OptimiserSettings::full()) \ + throw; \ + \ + reset(); \ + m_optimiserSettings = OptimiserSettings::full(); \ + { CODE } \ + } \ +} + + namespace solidity::frontend::test { From ffd495bd895b64bc920d102cfbf3e32190967b9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 22 Aug 2023 18:41:10 +0200 Subject: [PATCH 4/7] Increase gas in call_options_overload test to make it pass on homestead - After the test framework changes it fails via Yul on Homestead but passes on all other EVM versions and on legacy. The test itself does not seem to be testing these specific numbers so and increasing them resolves the problem. --- .../semanticTests/functionCall/call_options_overload.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/libsolidity/semanticTests/functionCall/call_options_overload.sol b/test/libsolidity/semanticTests/functionCall/call_options_overload.sol index 5e889e925..b9eb6ca42 100644 --- a/test/libsolidity/semanticTests/functionCall/call_options_overload.sol +++ b/test/libsolidity/semanticTests/functionCall/call_options_overload.sol @@ -3,9 +3,9 @@ contract C { function f(uint x, uint y) external payable returns (uint) { return 2; } function call() public payable returns (uint v, uint x, uint y, uint z) { v = this.f{value: 10}(2); - x = this.f{gas: 1000}(2, 3); - y = this.f{gas: 1000, value: 10}(2, 3); - z = this.f{value: 10, gas: 1000}(2, 3); + x = this.f{gas: 10000}(2, 3); + y = this.f{gas: 10000, value: 10}(2, 3); + z = this.f{value: 10, gas: 10000}(2, 3); } function bal() external returns (uint) { return address(this).balance; } receive() external payable {} From 38decf05dd387cc1542acd7acfc51bd08dc7bee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 22 Aug 2023 19:52:37 +0200 Subject: [PATCH 5/7] Update gas expectations --- ..._encode_v2_in_function_inherited_in_v1_contract.sol | 2 +- .../calldata_overlapped_dynamic_arrays.sol | 2 +- .../array/array_storage_index_boundary_test.sol | 4 ++-- .../semanticTests/array/byte_array_transitional_2.sol | 2 +- .../array/copying/array_copy_different_packing.sol | 2 +- .../array/copying/array_copy_nested_array.sol | 2 +- .../copying/array_copy_storage_to_memory_nested.sol | 2 +- .../array/copying/array_nested_memory_to_storage.sol | 2 +- ..._of_structs_containing_arrays_memory_to_storage.sol | 2 +- .../semanticTests/array/copying/array_to_mapping.sol | 2 +- .../array/copying/bytes_storage_to_storage.sol | 10 +++++----- .../copying/copy_byte_array_in_struct_to_storage.sol | 4 ++-- .../copying/copy_function_internal_storage_array.sol | 2 +- ..._of_nested_array_of_structs_calldata_to_storage.sol | 4 ++-- ...ts_of_nested_array_of_structs_memory_to_storage.sol | 6 +++--- .../array/copying/function_type_array_to_storage.sol | 4 ++-- .../array/copying/memory_dyn_2d_bytes_to_storage.sol | 2 +- .../nested_array_of_structs_calldata_to_storage.sol | 6 +++--- .../nested_array_of_structs_memory_to_storage.sol | 6 +++--- .../nested_array_of_structs_storage_to_storage.sol | 2 +- .../array/copying/storage_memory_nested_bytes.sol | 2 +- .../array/delete/bytes_delete_element.sol | 2 +- .../semanticTests/array/function_array_cross_calls.sol | 2 +- .../array/pop/array_pop_uint16_transition.sol | 2 +- .../array/pop/byte_array_pop_long_storage_empty.sol | 2 +- .../array/pop/byte_array_pop_masking_long.sol | 2 +- .../array/push/byte_array_push_transition.sol | 2 +- .../semanticTests/array/push/push_no_args_bytes.sol | 2 +- .../semanticTests/byte_array_to_storage_cleanup.sol | 2 +- .../constructor/arrays_in_constructors.sol | 2 +- .../constructor/bytes_in_constructors_packer.sol | 2 +- .../constructor/constructor_static_array_argument.sol | 2 +- .../externalContracts/prbmath_unsigned.sol | 2 +- .../semanticTests/externalContracts/ramanujan_pi.sol | 2 +- .../semanticTests/externalContracts/strings.sol | 4 ++-- .../semanticTests/immutable/multi_creation.sol | 2 +- .../libraries/internal_types_in_library.sol | 2 +- .../semanticTests/storage/empty_nonempty_empty.sol | 2 +- .../structs/copy_substructures_from_mapping.sol | 2 +- .../structs/copy_substructures_to_mapping.sol | 6 +++--- .../semanticTests/structs/copy_to_mapping.sol | 8 ++++---- .../semanticTests/various/destructuring_assignment.sol | 2 +- 42 files changed, 62 insertions(+), 62 deletions(-) diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol index 901e158db..07e517b2d 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol @@ -30,6 +30,6 @@ contract C is B { } // ---- // test() -> 77 -// gas irOptimized: 110731 +// gas irOptimized: 110325 // gas legacy: 151866 // gas legacyOptimized: 110359 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol index 2af8b8cde..a92336097 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol @@ -33,7 +33,7 @@ contract C { // f_which(uint256[],uint256[2],uint256): 0x40, 1, 2, 1, 5, 6 -> 0x20, 0x40, 5, 2 // f_which(uint256[],uint256[2],uint256): 0x40, 1, 2, 1 -> FAILURE // f_storage(uint256[],uint256[2]): 0x20, 1, 2 -> 0x20, 0x60, 0x20, 1, 2 -// gas irOptimized: 111639 +// gas irOptimized: 111642 // gas legacy: 112944 // gas legacyOptimized: 112092 // f_storage(uint256[],uint256[2]): 0x40, 1, 2, 5, 6 -> 0x20, 0x80, 0x20, 2, 5, 6 diff --git a/test/libsolidity/semanticTests/array/array_storage_index_boundary_test.sol b/test/libsolidity/semanticTests/array/array_storage_index_boundary_test.sol index a9e4fd8d3..c77aad0a4 100644 --- a/test/libsolidity/semanticTests/array/array_storage_index_boundary_test.sol +++ b/test/libsolidity/semanticTests/array/array_storage_index_boundary_test.sol @@ -16,11 +16,11 @@ contract C { // test_boundary_check(uint256,uint256): 1, 1 -> FAILURE, hex"4e487b71", 0x32 // test_boundary_check(uint256,uint256): 10, 10 -> FAILURE, hex"4e487b71", 0x32 // test_boundary_check(uint256,uint256): 256, 256 -> FAILURE, hex"4e487b71", 0x32 -// gas irOptimized: 137904 +// gas irOptimized: 137913 // gas legacy: 133633 // gas legacyOptimized: 114354 // test_boundary_check(uint256,uint256): 256, 255 -> 0 -// gas irOptimized: 140039 +// gas irOptimized: 140048 // gas legacy: 135949 // gas legacyOptimized: 116533 // test_boundary_check(uint256,uint256): 256, 0xFFFF -> FAILURE, hex"4e487b71", 0x32 diff --git a/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol index 92f58bd11..ae3d23a63 100644 --- a/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol +++ b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol @@ -17,6 +17,6 @@ contract c { } // ---- // test() -> 0 -// gas irOptimized: 125212 +// gas irOptimized: 125058 // gas legacy: 150372 // gas legacyOptimized: 146391 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol b/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol index 6d83f3758..f039ce0be 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol @@ -18,6 +18,6 @@ contract c { } // ---- // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000 -// gas irOptimized: 208044 +// gas irOptimized: 208053 // gas legacy: 221769 // gas legacyOptimized: 220611 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol b/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol index 4297f11fc..5e4adaa49 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol @@ -12,6 +12,6 @@ contract c { } // ---- // test(uint256[2][]): 32, 3, 7, 8, 9, 10, 11, 12 -> 10 -// gas irOptimized: 689666 +// gas irOptimized: 689654 // gas legacy: 686178 // gas legacyOptimized: 685628 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol index 86c76e765..6bd31ca5a 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol @@ -15,6 +15,6 @@ contract C { } // ---- // f() -> 0x20, 2, 0x40, 0xa0, 2, 0, 1, 2, 2, 3 -// gas irOptimized: 161627 +// gas irOptimized: 161624 // gas legacy: 162203 // gas legacyOptimized: 159934 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol index 9bd19d629..1bc50ab80 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol @@ -38,7 +38,7 @@ contract Test { } // ---- // test() -> 24 -// gas irOptimized: 226661 +// gas irOptimized: 226666 // gas legacy: 227084 // gas legacyOptimized: 226529 // test1() -> 3 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol index de7553c28..a38848294 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol @@ -26,4 +26,4 @@ contract C { // compileViaYul: true // ---- // f() -> 3, 3, 3, 1 -// gas irOptimized: 181912 +// gas irOptimized: 181894 diff --git a/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol b/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol index 540c6516f..50ea19a1e 100644 --- a/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol +++ b/test/libsolidity/semanticTests/array/copying/array_to_mapping.sol @@ -37,7 +37,7 @@ contract C { } // ---- // from_storage() -> 0x20, 2, 0x40, 0xa0, 2, 10, 11, 3, 12, 13, 14 -// gas irOptimized: 147868 +// gas irOptimized: 147871 // gas legacy: 148896 // gas legacyOptimized: 146901 // from_storage_ptr() -> 0x20, 2, 0x40, 0xa0, 2, 10, 11, 3, 12, 13, 14 diff --git a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol index 5b96afb03..4b91f666c 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol @@ -17,25 +17,25 @@ contract c { // ---- // f(uint256): 0 -> 0x20, 0x00 // f(uint256): 31 -> 0x20, 0x1f, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e00 -// gas irOptimized: 109794 +// gas irOptimized: 109839 // gas legacy: 123948 // gas legacyOptimized: 118948 // f(uint256): 32 -> 0x20, 0x20, 1780731860627700044960722568376592200742329637303199754547598369979440671 -// gas irOptimized: 124047 +// gas irOptimized: 124049 // gas legacy: 140362 // gas legacyOptimized: 135386 // f(uint256): 33 -> 0x20, 33, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x2000000000000000000000000000000000000000000000000000000000000000 -// gas irOptimized: 130663 +// gas irOptimized: 130665 // gas legacy: 147916 // gas legacyOptimized: 142278 // f(uint256): 63 -> 0x20, 0x3f, 1780731860627700044960722568376592200742329637303199754547598369979440671, 14532552714582660066924456880521368950258152170031413196862950297402215316992 -// gas irOptimized: 139543 +// gas irOptimized: 139545 // gas legacy: 171136 // gas legacyOptimized: 161538 // f(uint256): 12 -> 0x20, 0x0c, 0x0102030405060708090a0b0000000000000000000000000000000000000000 // gas legacy: 59345 // gas legacyOptimized: 57279 // f(uint256): 129 -> 0x20, 0x81, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f, 29063324697304692433803953038474361308315562010425523193971352996434451193439, 0x606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f, -57896044618658097711785492504343953926634992332820282019728792003956564819968 -// gas irOptimized: 442419 +// gas irOptimized: 442421 // gas legacy: 505021 // gas legacyOptimized: 486997 diff --git a/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol b/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol index cc2344cea..fdcc18835 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol @@ -35,11 +35,11 @@ contract C { } // ---- // f() -> 0x40, 0x80, 6, 0x6162636465660000000000000000000000000000000000000000000000000000, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000 -// gas irOptimized: 179737 +// gas irOptimized: 179734 // gas legacy: 181001 // gas legacyOptimized: 180018 // g() -> 0x40, 0xc0, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000, 0x11, 0x3132333435363738393233343536373839000000000000000000000000000000 -// gas irOptimized: 106666 +// gas irOptimized: 106663 // gas legacy: 109720 // gas legacyOptimized: 106932 // h() -> 0x40, 0x60, 0x00, 0x00 diff --git a/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol b/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol index 850803c13..8ee78ab9b 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_function_internal_storage_array.sol @@ -15,6 +15,6 @@ contract C { } // ---- // test() -> 7 -// gas irOptimized: 122454 +// gas irOptimized: 122456 // gas legacy: 205176 // gas legacyOptimized: 204971 diff --git a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol index 1214a73db..0562be2e2 100644 --- a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_calldata_to_storage.sol @@ -31,8 +31,8 @@ contract C { // compileViaYul: true // ---- // test1((uint8[],uint8[2])[][][]): 0x20, 1, 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -> 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -// gas irOptimized: 327844 +// gas irOptimized: 327847 // test2((uint8[],uint8[2])[][1][]): 0x20, 2, 0x40, 0x0160, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13, 0x20, 1, 0x20, 0x60, 31, 37, 2, 23, 29 -> 0x20, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13 // gas irOptimized: 140870 // test3((uint8[],uint8[2])[1][][2]): 0x20, 0x40, 0x60, 0, 2, 0x40, 288, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -> 0x20, 2, 0x40, 288, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -// gas irOptimized: 188515 +// gas irOptimized: 188517 diff --git a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol index b3eda2122..74dfa2d7a 100644 --- a/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/elements_of_nested_array_of_structs_memory_to_storage.sol @@ -31,8 +31,8 @@ contract C { // compileViaYul: true // ---- // test1((uint8[],uint8[2])[][][]): 0x20, 1, 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -> 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -// gas irOptimized: 332687 +// gas irOptimized: 332666 // test2((uint8[],uint8[2])[][1][]): 0x20, 2, 0x40, 0x0160, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13, 0x20, 1, 0x20, 0x60, 31, 37, 2, 23, 29 -> 0x20, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13 -// gas irOptimized: 145161 +// gas irOptimized: 145152 // test3((uint8[],uint8[2])[1][][2]): 0x20, 0x40, 0x60, 0, 2, 0x40, 288, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -> 0x20, 2, 0x40, 288, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -// gas irOptimized: 192608 +// gas irOptimized: 192602 diff --git a/test/libsolidity/semanticTests/array/copying/function_type_array_to_storage.sol b/test/libsolidity/semanticTests/array/copying/function_type_array_to_storage.sol index 53455e9eb..a357147c5 100644 --- a/test/libsolidity/semanticTests/array/copying/function_type_array_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/function_type_array_to_storage.sol @@ -46,11 +46,11 @@ contract C { } // ---- // test() -> 0x20, 0x14, "[a called][b called]" -// gas irOptimized: 116631 +// gas irOptimized: 116633 // gas legacy: 118936 // gas legacyOptimized: 116975 // test2() -> 0x20, 0x14, "[b called][a called]" // test3() -> 0x20, 0x14, "[b called][a called]" -// gas irOptimized: 103241 +// gas irOptimized: 103243 // gas legacy: 102745 // gas legacyOptimized: 101669 diff --git a/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol b/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol index f659c28d6..1dd321d45 100644 --- a/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol @@ -18,6 +18,6 @@ contract C { } // ---- // f() -> 3 -// gas irOptimized: 128273 +// gas irOptimized: 128264 // gas legacy: 130584 // gas legacyOptimized: 129028 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol index 52dcb2565..27046de2b 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_calldata_to_storage.sol @@ -29,8 +29,8 @@ contract C { // compileViaYul: true // ---- // test1((uint8[],uint8[2])[][]): 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -> 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -// gas irOptimized: 304751 +// gas irOptimized: 304720 // test2((uint8[],uint8[2])[][1]): 0x20, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13 -> 0x20, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13 -// gas irOptimized: 116449 +// gas irOptimized: 116455 // test3((uint8[],uint8[2])[1][]): 0x20, 2, 0x40, 0x0120, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -> 0x20, 2, 0x40, 0x0120, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -// gas irOptimized: 188004 +// gas irOptimized: 188006 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol index 48513d001..2ebf29221 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_memory_to_storage.sol @@ -29,8 +29,8 @@ contract C { // compileViaYul: true // ---- // test1((uint8[],uint8[2])[][]): 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -> 0x20, 2, 0x40, 0x0140, 1, 0x20, 0x60, 3, 7, 2, 1, 2, 2, 0x40, 0x0100, 0x60, 17, 19, 2, 11, 13, 0x60, 31, 37, 2, 23, 29 -// gas irOptimized: 309071 +// gas irOptimized: 309077 // test2((uint8[],uint8[2])[][1]): 0x20, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13 -> 0x20, 0x20, 1, 0x20, 0x60, 17, 19, 2, 11, 13 -// gas irOptimized: 118264 +// gas irOptimized: 118258 // test3((uint8[],uint8[2])[1][]): 0x20, 2, 0x40, 0x0120, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -> 0x20, 2, 0x40, 0x0120, 0x20, 0x60, 3, 7, 2, 1, 2, 0x20, 0x60, 17, 19, 2, 11, 13 -// gas irOptimized: 191003 +// gas irOptimized: 190997 diff --git a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol index be2e2447e..c356e029f 100644 --- a/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/nested_array_of_structs_storage_to_storage.sol @@ -65,5 +65,5 @@ contract C { // test1() // gas irOptimized: 123202 // test2() -// gas irOptimized: 123030 +// gas irOptimized: 123027 // test3() diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol index 5bbff52fb..d394b6582 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol @@ -11,6 +11,6 @@ contract C { } // ---- // f() -> 0x20, 0x02, 0x40, 0x80, 3, 0x6162630000000000000000000000000000000000000000000000000000000000, 0x99, 44048183304486788312148433451363384677562265908331949128489393215789685032262, 32241931068525137014058842823026578386641954854143559838526554899205067598957, 49951309422467613961193228765530489307475214998374779756599339590522149884499, 0x54555658595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0x4142434445464748494a4b4c4d4e4f5051525354555658595a00000000000000 -// gas irOptimized: 202738 +// gas irOptimized: 202735 // gas legacy: 204798 // gas legacyOptimized: 203357 diff --git a/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol b/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol index 583f6af17..499289820 100644 --- a/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol +++ b/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol @@ -16,6 +16,6 @@ contract c { } // ---- // test1() -> true -// gas irOptimized: 206086 +// gas irOptimized: 206386 // gas legacy: 254056 // gas legacyOptimized: 246892 diff --git a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol index a2bc2ff90..e91608966 100644 --- a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol +++ b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol @@ -42,6 +42,6 @@ contract C { } // ---- // test() -> 5, 6, 7 -// gas irOptimized: 256074 +// gas irOptimized: 256077 // gas legacy: 441556 // gas legacyOptimized: 279321 diff --git a/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol b/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol index 93e1512bc..a999ba513 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol @@ -18,7 +18,7 @@ contract c { } // ---- // test() -> 38, 28, 18 -// gas irOptimized: 148087 +// gas irOptimized: 148543 // gas legacy: 151184 // gas legacyOptimized: 142418 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol index 68e52a195..a3ba9d4d2 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol @@ -16,7 +16,7 @@ contract c { } // ---- // test() -> true -// gas irOptimized: 140056 +// gas irOptimized: 140154 // gas legacy: 178397 // gas legacyOptimized: 163832 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol index e4e0b0b0d..07bad3a26 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol @@ -9,6 +9,6 @@ contract c { } // ---- // test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000 -// gas irOptimized: 107969 +// gas irOptimized: 107976 // gas legacy: 125420 // gas legacyOptimized: 122472 diff --git a/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol b/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol index 3b49b22d7..808d0d866 100644 --- a/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol +++ b/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol @@ -15,6 +15,6 @@ contract c { } // ---- // test() -> 0 -// gas irOptimized: 172113 +// gas irOptimized: 171996 // gas legacy: 215891 // gas legacyOptimized: 203615 diff --git a/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol b/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol index 6a2b70153..162f49817 100644 --- a/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol +++ b/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol @@ -21,7 +21,7 @@ contract C { // ---- // l() -> 0 // g(uint256): 70 -> -// gas irOptimized: 182497 +// gas irOptimized: 182707 // gas legacy: 183445 // gas legacyOptimized: 178995 // l() -> 70 diff --git a/test/libsolidity/semanticTests/byte_array_to_storage_cleanup.sol b/test/libsolidity/semanticTests/byte_array_to_storage_cleanup.sol index c09528d2b..95d3b916f 100644 --- a/test/libsolidity/semanticTests/byte_array_to_storage_cleanup.sol +++ b/test/libsolidity/semanticTests/byte_array_to_storage_cleanup.sol @@ -28,7 +28,7 @@ contract C { // compileViaYul: also // ---- // constructor() -> -// gas irOptimized: 439080 +// gas irOptimized: 442530 // gas legacy: 711299 // gas legacyOptimized: 481296 // h() -> 0x20, 0x40, 0x00, 0 diff --git a/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol b/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol index 2bfab4fe6..f9038fb76 100644 --- a/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol +++ b/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol @@ -24,6 +24,6 @@ contract Creator { } // ---- // f(uint256,address[]): 7, 0x40, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 -> 7, 8 -// gas irOptimized: 424511 +// gas irOptimized: 424508 // gas legacy: 581443 // gas legacyOptimized: 444588 diff --git a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol index b4d5dd880..3361fa310 100644 --- a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol +++ b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol @@ -24,6 +24,6 @@ contract Creator { } // ---- // f(uint256,bytes): 7, 0x40, 78, "abcdefghijklmnopqrstuvwxyzabcdef", "ghijklmnopqrstuvwxyzabcdefghijkl", "mnopqrstuvwxyz" -> 7, "h" -// gas irOptimized: 275287 +// gas irOptimized: 275487 // gas legacy: 418462 // gas legacyOptimized: 291760 diff --git a/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol b/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol index 75fa809ed..4698d26ee 100644 --- a/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol +++ b/test/libsolidity/semanticTests/constructor/constructor_static_array_argument.sol @@ -9,7 +9,7 @@ contract C { } // ---- // constructor(): 1, 2, 3, 4 -> -// gas irOptimized: 171018 +// gas irOptimized: 170999 // gas legacy: 218378 // gas legacyOptimized: 176195 // a() -> 1 diff --git a/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol b/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol index 1e546feab..1ecfc154a 100644 --- a/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol +++ b/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol @@ -48,7 +48,7 @@ contract test { } // ---- // constructor() -// gas irOptimized: 1723462 +// gas irOptimized: 1723666 // gas legacy: 2210160 // gas legacyOptimized: 1734152 // div(uint256,uint256): 3141592653589793238, 88714123 -> 35412542528203691288251815328 diff --git a/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol b/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol index 19a79f537..a1f1d6395 100644 --- a/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol +++ b/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol @@ -33,7 +33,7 @@ contract test { } // ---- // constructor() -// gas irOptimized: 406643 +// gas irOptimized: 407075 // gas legacy: 631753 // gas legacyOptimized: 459425 // prb_pi() -> 3141592656369545286 diff --git a/test/libsolidity/semanticTests/externalContracts/strings.sol b/test/libsolidity/semanticTests/externalContracts/strings.sol index c3eba4e0f..41820c8a4 100644 --- a/test/libsolidity/semanticTests/externalContracts/strings.sol +++ b/test/libsolidity/semanticTests/externalContracts/strings.sol @@ -49,7 +49,7 @@ contract test { } // ---- // constructor() -// gas irOptimized: 632372 +// gas irOptimized: 633020 // gas legacy: 1065857 // gas legacyOptimized: 725207 // toSlice(string): 0x20, 11, "hello world" -> 11, 0xa0 @@ -69,6 +69,6 @@ contract test { // gas legacy: 31621 // gas legacyOptimized: 27914 // benchmark(string,bytes32): 0x40, 0x0842021, 8, "solidity" -> 0x2020 -// gas irOptimized: 1981664 +// gas irOptimized: 1981677 // gas legacy: 4235651 // gas legacyOptimized: 2319622 diff --git a/test/libsolidity/semanticTests/immutable/multi_creation.sol b/test/libsolidity/semanticTests/immutable/multi_creation.sol index e03861450..4302b42e1 100644 --- a/test/libsolidity/semanticTests/immutable/multi_creation.sol +++ b/test/libsolidity/semanticTests/immutable/multi_creation.sol @@ -27,7 +27,7 @@ contract C { } // ---- // f() -> 3, 7, 5 -// gas irOptimized: 124003 +// gas irOptimized: 124024 // gas legacy: 148528 // gas legacyOptimized: 123971 // x() -> 7 diff --git a/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol b/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol index 8a4356061..3da10930c 100644 --- a/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol +++ b/test/libsolidity/semanticTests/libraries/internal_types_in_library.sol @@ -22,6 +22,6 @@ contract Test { // ---- // library: Lib // f() -> 4, 0x11 -// gas irOptimized: 112115 +// gas irOptimized: 112046 // gas legacy: 135413 // gas legacyOptimized: 119325 diff --git a/test/libsolidity/semanticTests/storage/empty_nonempty_empty.sol b/test/libsolidity/semanticTests/storage/empty_nonempty_empty.sol index 7897144d5..5f3242165 100644 --- a/test/libsolidity/semanticTests/storage/empty_nonempty_empty.sol +++ b/test/libsolidity/semanticTests/storage/empty_nonempty_empty.sol @@ -22,7 +22,7 @@ contract Test { // set(bytes): 0x20, 0 // storageEmpty -> 1 // set(bytes): 0x20, 66, "12345678901234567890123456789012", "12345678901234567890123456789012", "12" -// gas irOptimized: 111878 +// gas irOptimized: 111886 // gas legacy: 112734 // gas legacyOptimized: 112115 // storageEmpty -> 0 diff --git a/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol b/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol index b6e374f2a..902cc80e5 100644 --- a/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol +++ b/test/libsolidity/semanticTests/structs/copy_substructures_from_mapping.sol @@ -44,7 +44,7 @@ contract C { } // ---- // to_state() -> 0x20, 0x60, 0xa0, 7, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 121584 +// gas irOptimized: 121598 // gas legacy: 123208 // gas legacyOptimized: 121766 // to_storage() -> 0x20, 0x60, 0xa0, 7, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 diff --git a/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol b/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol index 2e1d5cb2d..66716e400 100644 --- a/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol +++ b/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol @@ -52,14 +52,14 @@ contract C { } // ---- // from_memory() -> 0x20, 0x60, 0xa0, 0x15, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 123028 +// gas irOptimized: 123034 // gas legacy: 130227 // gas legacyOptimized: 128761 // from_state() -> 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 121703 +// gas irOptimized: 121709 // gas legacy: 123282 // gas legacyOptimized: 121871 // from_calldata((bytes,uint16[],uint16)): 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -> 0x20, 0x60, 0xa0, 0x15, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 115113 +// gas irOptimized: 115131 // gas legacy: 122516 // gas legacyOptimized: 120807 diff --git a/test/libsolidity/semanticTests/structs/copy_to_mapping.sol b/test/libsolidity/semanticTests/structs/copy_to_mapping.sol index 5b55a99b9..30df195d8 100644 --- a/test/libsolidity/semanticTests/structs/copy_to_mapping.sol +++ b/test/libsolidity/semanticTests/structs/copy_to_mapping.sol @@ -45,18 +45,18 @@ contract C { } // ---- // from_state() -> 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 121680 +// gas irOptimized: 121686 // gas legacy: 123144 // gas legacyOptimized: 121811 // from_storage() -> 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 121725 +// gas irOptimized: 121731 // gas legacy: 123193 // gas legacyOptimized: 121863 // from_memory() -> 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 122939 +// gas irOptimized: 122942 // gas legacy: 130088 // gas legacyOptimized: 128757 // from_calldata((bytes,uint16[],uint16)): 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -> 0x20, 0x60, 0xa0, 21, 3, 0x666f6f0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 115032 +// gas irOptimized: 115046 // gas legacy: 118301 // gas legacyOptimized: 115435 diff --git a/test/libsolidity/semanticTests/various/destructuring_assignment.sol b/test/libsolidity/semanticTests/various/destructuring_assignment.sol index b13db85d1..9fe9a8a74 100644 --- a/test/libsolidity/semanticTests/various/destructuring_assignment.sol +++ b/test/libsolidity/semanticTests/various/destructuring_assignment.sol @@ -33,6 +33,6 @@ contract C { } // ---- // f(bytes): 0x20, 0x5, "abcde" -> 0 -// gas irOptimized: 241832 +// gas irOptimized: 241841 // gas legacy: 243284 // gas legacyOptimized: 242420 From a4d777643d4c77904b13b31f1fdc05a5f44e7b4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 22 Aug 2023 20:19:20 +0200 Subject: [PATCH 6/7] fixup! Change semantic tests to use the proper via IR pipeline, without rerunning on exceptions --- test/libsolidity/SemanticTest.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index c33ceecea..14e6877c0 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -295,7 +295,8 @@ optional SemanticTest::matchEvent(util::h256 const& has frontend::OptimiserSettings SemanticTest::optimizerSettingsFor(RequiresYulOptimizer _requiresYulOptimizer) { - switch (_requiresYulOptimizer) { + switch (_requiresYulOptimizer) + { case RequiresYulOptimizer::False: return OptimiserSettings::minimal(); case RequiresYulOptimizer::MinimalStack: From 1bb596096b804aebc8e4bb84af2876d6c1c77a37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Tue, 22 Aug 2023 20:32:12 +0200 Subject: [PATCH 7/7] fixup! Change semantic tests to use the proper via IR pipeline, without rerunning on exceptions --- test/libsolidity/SemanticTest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/libsolidity/SemanticTest.cpp b/test/libsolidity/SemanticTest.cpp index 14e6877c0..0997a6625 100644 --- a/test/libsolidity/SemanticTest.cpp +++ b/test/libsolidity/SemanticTest.cpp @@ -669,14 +669,15 @@ void SemanticTest::printUpdatedExpectations(ostream& _stream, string const&) con void SemanticTest::printUpdatedSettings(ostream& _stream, string const& _linePrefix) { auto& settings = m_reader.settings(); - if (settings.empty()) + if (settings.empty() && m_requiresYulOptimizer == RequiresYulOptimizer::False) return; _stream << _linePrefix << "// ====" << endl; + if (m_requiresYulOptimizer != RequiresYulOptimizer::False) + _stream << _linePrefix << "// requiresYulOptimizer: " << m_requiresYulOptimizer << endl; + for (auto const& [settingName, settingValue]: settings) - if (settingName == "requiresYulOptimizer") - _stream << _linePrefix << "// " << settingName << ": " << m_requiresYulOptimizer << endl; - else + if (settingName != "requiresYulOptimizer") _stream << _linePrefix << "// " << settingName << ": " << settingValue<< endl; }