diff --git a/libyul/optimiser/CommonSubexpressionEliminator.cpp b/libyul/optimiser/CommonSubexpressionEliminator.cpp index 148d56c8b..c2b5f8a42 100644 --- a/libyul/optimiser/CommonSubexpressionEliminator.cpp +++ b/libyul/optimiser/CommonSubexpressionEliminator.cpp @@ -29,6 +29,7 @@ #include #include #include +#include using namespace std; using namespace solidity; @@ -52,6 +53,16 @@ CommonSubexpressionEliminator::CommonSubexpressionEliminator( { } +void CommonSubexpressionEliminator::operator()(FunctionDefinition& _fun) +{ + ScopedSaveAndRestore returnVariables(m_returnVariables, {}); + + for (auto const& v: _fun.returnVariables) + m_returnVariables.insert(v.name); + + DataFlowAnalyzer::operator()(_fun); +} + void CommonSubexpressionEliminator::visit(Expression& _e) { bool descend = true; @@ -82,10 +93,9 @@ void CommonSubexpressionEliminator::visit(Expression& _e) if (descend) DataFlowAnalyzer::visit(_e); - if (holds_alternative(_e)) + if (Identifier const* identifier = get_if(&_e)) { - Identifier& identifier = std::get(_e); - YulString name = identifier.name; + YulString name = identifier->name; if (m_value.count(name)) { assertThrow(m_value.at(name).value, OptimizerException, ""); @@ -100,6 +110,14 @@ void CommonSubexpressionEliminator::visit(Expression& _e) for (auto const& [variable, value]: m_value) { assertThrow(value.value, OptimizerException, ""); + // Prevent using the default value of return variables + // instead of literal zeros. + if ( + m_returnVariables.count(variable) && + holds_alternative(*value.value) && + valueOfLiteral(get(*value.value)) == 0 + ) + continue; if (SyntacticallyEqual{}(_e, *value.value) && inScope(variable)) { _e = Identifier{locationOf(_e), variable}; diff --git a/libyul/optimiser/CommonSubexpressionEliminator.h b/libyul/optimiser/CommonSubexpressionEliminator.h index f11de51a4..08554fe17 100644 --- a/libyul/optimiser/CommonSubexpressionEliminator.h +++ b/libyul/optimiser/CommonSubexpressionEliminator.h @@ -25,6 +25,8 @@ #include #include +#include + namespace solidity::yul { @@ -43,6 +45,9 @@ public: static constexpr char const* name{"CommonSubexpressionEliminator"}; static void run(OptimiserStepContext&, Block& _ast); + using DataFlowAnalyzer::operator(); + void operator()(FunctionDefinition&) override; + private: CommonSubexpressionEliminator( Dialect const& _dialect, @@ -52,6 +57,9 @@ private: protected: using ASTModifier::visit; void visit(Expression& _e) override; + +private: + std::set m_returnVariables; }; } diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol index 68c2a3715..a3c28f339 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol @@ -66,4 +66,4 @@ contract C { // test_uint256() -> // gas irOptimized: 704259 // gas legacy: 634592 -// gas legacyOptimized: 499373 +// gas legacyOptimized: 499337 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol index 6df97f7ba..f28d3bac5 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol @@ -67,4 +67,4 @@ contract C { // test_uint256() -> // gas irOptimized: 704259 // gas legacy: 634592 -// gas legacyOptimized: 499373 +// gas legacyOptimized: 499337 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol index c325dcf85..c0ffd872e 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol @@ -21,6 +21,6 @@ contract C { // f(uint256[][1]): 32, 32, 0 -> true // f(uint256[][1]): 32, 32, 1, 42 -> true // f(uint256[][1]): 32, 32, 8, 421, 422, 423, 424, 425, 426, 427, 428 -> true -// gas irOptimized: 227067 +// gas irOptimized: 227075 // gas legacy: 144300 -// gas legacyOptimized: 124189 +// gas legacyOptimized: 124188 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol index 847557fdc..0452817f6 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol @@ -19,10 +19,10 @@ contract C { // compileViaYul: also // ---- // h(uint256[2][]): 0x20, 3, 123, 124, 223, 224, 323, 324 -> 32, 256, 0x20, 3, 123, 124, 223, 224, 323, 324 -// gas irOptimized: 172480 +// gas irOptimized: 172488 // gas legacy: 175929 // gas legacyOptimized: 172504 // i(uint256[2][2]): 123, 124, 223, 224 -> 32, 128, 123, 124, 223, 224 -// gas irOptimized: 107421 +// gas irOptimized: 107381 // gas legacy: 109868 // gas legacyOptimized: 107388 diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol index db17564cc..25b085a4b 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol @@ -11,6 +11,6 @@ contract C { // compileViaYul: also // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" -// gas irOptimized: 130131 +// gas irOptimized: 130136 // gas legacy: 131690 -// gas legacyOptimized: 130577 +// gas legacyOptimized: 130582 diff --git a/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol b/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol index 196b8c6d7..519f20f6f 100644 --- a/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol +++ b/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol @@ -14,7 +14,7 @@ contract Test { // compileViaYul: also // ---- // set(uint24[3][]): 0x20, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 -> 0x06 -// gas irOptimized: 199727 +// gas irOptimized: 199732 // gas legacy: 278685 // gas legacyOptimized: 273594 // data(uint256,uint256): 0x02, 0x02 -> 0x09 diff --git a/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol index fabe6615a..014df1adc 100644 --- a/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol +++ b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol @@ -47,7 +47,7 @@ contract c { // gas legacyOptimized: 109706 // storage: nonempty // test_long() -> 67 -// gas irOptimized: 134398 +// gas irOptimized: 134403 // gas legacy: 213590 // gas legacyOptimized: 211044 // storage: nonempty diff --git a/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol index 737116c20..2c55c5912 100644 --- a/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol +++ b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol @@ -19,6 +19,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0 -// gas irOptimized: 310460 +// gas irOptimized: 310785 // gas legacy: 483915 // gas legacyOptimized: 478672 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol index b91999d2c..29344623d 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol @@ -42,7 +42,7 @@ contract C { // compileViaYul: also // ---- // f() -> 0 -// gas irOptimized: 107698 +// gas irOptimized: 107703 // gas legacy: 107306 // gas legacyOptimized: 105861 // g() -> 0 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol b/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol index 5ea1f2407..699411df9 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol @@ -37,7 +37,7 @@ contract c { // compileViaYul: also // ---- // test() -> 0x02000202 -// gas irOptimized: 2477765 +// gas irOptimized: 2471556 // gas legacy: 2288641 // gas legacyOptimized: 2258654 // storage: empty 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 6ec9b0700..99a548fb8 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol @@ -15,6 +15,6 @@ contract c { // compileViaYul: also // ---- // test(uint256[2][]): 32, 3, 7, 8, 9, 10, 11, 12 -> 10 -// gas irOptimized: 610552 +// gas irOptimized: 610560 // gas legacy: 604268 // gas legacyOptimized: 603688 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol index afecf6641..47465079b 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol @@ -23,6 +23,6 @@ contract c { // compileViaYul: also // ---- // test() -> 3, 4 -// gas irOptimized: 191170 +// gas irOptimized: 191158 // gas legacy: 208853 // gas legacyOptimized: 200341 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol index fa2904c6a..f7554a911 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol @@ -20,6 +20,6 @@ contract c { // compileViaYul: also // ---- // test() -> 5, 4 -// gas irOptimized: 265174 +// gas irOptimized: 265126 // gas legacy: 264734 // gas legacyOptimized: 263160 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol index d8b1ca1fb..fe8632469 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test() -> 8, 0 -// gas irOptimized: 154793 +// gas irOptimized: 154656 // gas legacy: 153995 // gas legacyOptimized: 153403 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 17c046ebc..35b008c96 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 @@ -17,6 +17,6 @@ contract C { // compileViaYul: also // ---- // f() -> 0x20, 2, 0x40, 0xa0, 2, 0, 1, 2, 2, 3 -// gas irOptimized: 168698 +// gas irOptimized: 168812 // gas legacy: 163978 -// gas legacyOptimized: 158150 +// gas legacyOptimized: 158155 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol index e06b380f6..8a8244a90 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol @@ -38,10 +38,10 @@ contract c { // compileViaYul: true // ---- // test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65 -// gas irOptimized: 179276 +// gas irOptimized: 179354 // test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65 -// gas irOptimized: 154026 +// gas irOptimized: 154106 // test3(uint256[2][]): 0x20, 2, 23, 42, 23, 42 -> 2, 65 -// gas irOptimized: 132691 +// gas irOptimized: 132579 // test4(uint256[2][2]): 23, 42, 23, 42 -> 65 -// gas irOptimized: 105429 +// gas irOptimized: 105395 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol index a2c954811..00cfd3b04 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol @@ -23,4 +23,4 @@ contract C { // compileViaYul: true // ---- // f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1 -// gas irOptimized: 353946 +// gas irOptimized: 353951 diff --git a/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol b/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol index 409dab842..fa35f6437 100644 --- a/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol +++ b/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol @@ -15,6 +15,6 @@ contract C { // compileViaYul: also // ---- // f() -> 1, 2, 3 -// gas irOptimized: 133483 +// gas irOptimized: 133471 // gas legacy: 134419 // gas legacyOptimized: 125440 diff --git a/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol b/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol index 1957dc34f..231cd2271 100644 --- a/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol @@ -12,7 +12,7 @@ contract Test { // compileViaYul: also // ---- // set(uint24[]): 0x20, 18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 -> 18 -// gas irOptimized: 120939 +// gas irOptimized: 120898 // gas legacy: 125815 // gas legacyOptimized: 123614 // data(uint256): 7 -> 8 diff --git a/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol b/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol index 1c7358edf..b946f7987 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol @@ -7,11 +7,11 @@ contract c { // compileViaYul: also // ---- // set(uint256): 1, 2 -> true -// gas irOptimized: 103240 +// gas irOptimized: 103242 // gas legacy: 103491 // gas legacyOptimized: 103136 // set(uint256): 2, 2, 3, 4, 5 -> true -// gas irOptimized: 163927 +// gas irOptimized: 163929 // gas legacy: 164121 // gas legacyOptimized: 163766 // storage: nonempty diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol index af6bf29c3..06a958de9 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol @@ -11,6 +11,6 @@ contract C { // compileViaYul: also // ---- // f(uint256[]): 0x20, 0x03, 0x1, 0x2, 0x3 -> 0x1 -// gas irOptimized: 105249 +// gas irOptimized: 105262 // gas legacy: 105365 // gas legacyOptimized: 105147 diff --git a/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol b/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol index cfc93f23c..d03084d6d 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol @@ -18,6 +18,6 @@ contract C { // compileViaYul: also // ---- // test() -> 7 -// gas irOptimized: 134153 +// gas irOptimized: 134158 // gas legacy: 211296 // gas legacyOptimized: 211087 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol index 7ab0fb5d4..7619e1fda 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol @@ -19,6 +19,6 @@ contract C { // compileViaYul: also // ---- // f() -> 1, 2, 3, 4, 5, 6, 7 -// gas irOptimized: 212626 +// gas irOptimized: 212646 // gas legacy: 223725 // gas legacyOptimized: 222886 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 6d2f07ae3..c519bc50d 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol @@ -13,6 +13,6 @@ contract C { // compileViaYul: also // ---- // f() -> 0x20, 0x02, 0x40, 0x80, 3, 0x6162630000000000000000000000000000000000000000000000000000000000, 0x99, 44048183304486788312148433451363384677562265908331949128489393215789685032262, 32241931068525137014058842823026578386641954854143559838526554899205067598957, 49951309422467613961193228765530489307475214998374779756599339590522149884499, 0x54555658595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0x4142434445464748494a4b4c4d4e4f5051525354555658595a00000000000000 -// gas irOptimized: 198384 +// gas irOptimized: 198396 // gas legacy: 199159 -// gas legacyOptimized: 198132 +// gas legacyOptimized: 198137 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol index 37abc0a86..02bb25b12 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol @@ -20,6 +20,6 @@ contract C { // compileViaYul: also // ---- // f() -> 1, 2, 3, 4, 5, 6, 7 -// gas irOptimized: 212626 +// gas irOptimized: 212646 // gas legacy: 223730 // gas legacyOptimized: 222891 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_struct.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_struct.sol index 7c623884d..f12955480 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_struct.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_struct.sol @@ -26,6 +26,6 @@ contract C { // compileViaYul: also // ---- // f() -> 11, 0x0c, 1, 0x15, 22, 4 -// gas irOptimized: 289307 +// gas irOptimized: 289252 // gas legacy: 296916 // gas legacyOptimized: 283163 diff --git a/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol b/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol index a90617d6e..d333e70ef 100644 --- a/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol +++ b/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test1() -> true -// gas irOptimized: 531720 +// gas irOptimized: 532255 // gas legacy: 613377 // gas legacyOptimized: 606411 diff --git a/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol b/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol index 2a90ea0c9..bcd034c67 100644 --- a/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol +++ b/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol @@ -44,7 +44,7 @@ contract c { // ---- // getLengths() -> 0, 0 // setLengths(uint256,uint256): 48, 49 -> -// gas irOptimized: 276212 +// gas irOptimized: 275838 // gas legacy: 308271 // gas legacyOptimized: 300117 // getLengths() -> 48, 49 diff --git a/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol b/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol index 7cf5f8775..1f7eaa582 100644 --- a/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol +++ b/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol @@ -18,7 +18,7 @@ contract c { // ---- // storage: empty // fill() -> 8 -// gas irOptimized: 170087 +// gas irOptimized: 170102 // gas legacy: 165456 // gas legacyOptimized: 164387 // storage: nonempty diff --git a/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol b/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol index 8cffe537d..c0a1c4a9a 100644 --- a/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol +++ b/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol @@ -21,6 +21,6 @@ contract B { // compileViaYul: also // ---- // f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004 -// gas irOptimized: 135461 +// gas irOptimized: 135871 // gas legacy: 264410 -// gas legacyOptimized: 134899 +// gas legacyOptimized: 135699 diff --git a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol index e88381eae..c120d3bc7 100644 --- a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol +++ b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol @@ -45,6 +45,6 @@ contract C { // compileViaYul: also // ---- // test() -> 5, 6, 7 -// gas irOptimized: 345131 +// gas irOptimized: 345542 // gas legacy: 500424 -// gas legacyOptimized: 307813 +// gas legacyOptimized: 309013 diff --git a/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol b/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol index 9ab3ac9f0..641ebe994 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol @@ -25,7 +25,7 @@ contract c { // compileViaYul: also // ---- // test() -> 1, 2, 3 -// gas irOptimized: 2462085 +// gas irOptimized: 2461941 // gas legacy: 2416722 // gas legacyOptimized: 2405396 // storage: empty 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 6360ccea3..ce8b56f0c 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol @@ -20,7 +20,7 @@ contract c { // compileViaYul: also // ---- // test() -> 38, 28, 18 -// gas irOptimized: 531723 +// gas irOptimized: 532515 // gas legacy: 454080 // gas legacyOptimized: 443170 // storage: empty diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol index ed21c0c4d..a0722f597 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol @@ -12,6 +12,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x20, 29, 0x0303030303030303030303030303030303030303030303030303030303000000 -// gas irOptimized: 162649 +// gas irOptimized: 162592 // gas legacy: 245809 // gas legacyOptimized: 242636 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 8b3694cdb..e5b28c92d 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 @@ -12,6 +12,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000 -// gas irOptimized: 160043 +// gas irOptimized: 159929 // gas legacy: 243287 // gas legacyOptimized: 240361 diff --git a/test/libsolidity/semanticTests/array/push/array_push.sol b/test/libsolidity/semanticTests/array/push/array_push.sol index 6cb35a4f8..4ad82d666 100644 --- a/test/libsolidity/semanticTests/array/push/array_push.sol +++ b/test/libsolidity/semanticTests/array/push/array_push.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test() -> 5, 4, 3, 3 -// gas irOptimized: 110985 +// gas irOptimized: 110915 // gas legacy: 111938 // gas legacyOptimized: 110528 diff --git a/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol b/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol index 3d9ebcca0..fec11262b 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol @@ -14,6 +14,6 @@ contract C { // compileViaYul: also // ---- // f(uint120[]): 0x20, 3, 1, 2, 3 -> 1 -// gas irOptimized: 116343 +// gas irOptimized: 116340 // gas legacy: 116886 // gas legacyOptimized: 116699 diff --git a/test/libsolidity/semanticTests/array/push/array_push_struct.sol b/test/libsolidity/semanticTests/array/push/array_push_struct.sol index 167c07bfb..3704adfd6 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_struct.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_struct.sol @@ -22,6 +22,6 @@ contract c { // compileViaYul: also // ---- // test() -> 2, 3, 4, 5 -// gas irOptimized: 146473 +// gas irOptimized: 146470 // gas legacy: 190684 // gas legacyOptimized: 188256 diff --git a/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol b/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol index 39523e504..dbfa16ab4 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test((uint16,uint16,uint16[3],uint16[])): 0x20, 2, 3, 0, 0, 4, 0xC0, 4, 0, 0, 5, 0, 0 -> 2, 3, 4, 5 -// gas irOptimized: 148190 +// gas irOptimized: 148198 // gas legacy: 152444 // gas legacyOptimized: 146671 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 300703bee..227d605d0 100644 --- a/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol +++ b/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol @@ -17,6 +17,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0 -// gas irOptimized: 396077 +// gas irOptimized: 396502 // gas legacy: 565428 // gas legacyOptimized: 552524 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 088c4bddd..94d308e48 100644 --- a/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol +++ b/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol @@ -23,7 +23,7 @@ contract C { // ---- // l() -> 0 // g(uint256): 70 -> -// gas irOptimized: 434229 +// gas irOptimized: 430584 // gas legacy: 419791 // gas legacyOptimized: 415408 // l() -> 70 diff --git a/test/libsolidity/semanticTests/array/reusing_memory.sol b/test/libsolidity/semanticTests/array/reusing_memory.sol index 1f43ae70e..d8e1bfcb8 100644 --- a/test/libsolidity/semanticTests/array/reusing_memory.sol +++ b/test/libsolidity/semanticTests/array/reusing_memory.sol @@ -26,6 +26,6 @@ contract Main { // compileViaYul: also // ---- // f(uint256): 0x34 -> 0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 -// gas irOptimized: 115537 +// gas irOptimized: 115528 // gas legacy: 127152 // gas legacyOptimized: 113679 diff --git a/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol b/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol index a04b4702a..d28d20da9 100644 --- a/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol +++ b/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol @@ -26,6 +26,6 @@ contract Creator { // compileViaYul: also // ---- // f(uint256,address[]): 7, 0x40, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 -> 7, 8 -// gas irOptimized: 465850 +// gas irOptimized: 469081 // gas legacy: 570900 -// gas legacyOptimized: 435524 +// gas legacyOptimized: 436724 diff --git a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol index 21fad1600..d9e4d27a9 100644 --- a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol +++ b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol @@ -26,6 +26,6 @@ contract Creator { // compileViaYul: also // ---- // f(uint256,bytes): 7, 0x40, 78, "abcdefghijklmnopqrstuvwxyzabcdef", "ghijklmnopqrstuvwxyzabcdefghijkl", "mnopqrstuvwxyz" -> 7, "h" -// gas irOptimized: 322968 +// gas irOptimized: 325793 // gas legacy: 414850 -// gas legacyOptimized: 290278 +// gas legacyOptimized: 292281 diff --git a/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol b/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol index 17eb77c9d..0a79d922b 100644 --- a/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol +++ b/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol @@ -178,33 +178,33 @@ contract DepositContract is IDepositContract, ERC165 { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 1814535 +// gas irOptimized: 1826340 // gas legacy: 2558004 -// gas legacyOptimized: 1797889 +// gas legacyOptimized: 1798657 // supportsInterface(bytes4): 0x0 -> 0 // supportsInterface(bytes4): 0xffffffff00000000000000000000000000000000000000000000000000000000 -> false # defined to be false by ERC-165 # // supportsInterface(bytes4): 0x01ffc9a700000000000000000000000000000000000000000000000000000000 -> true # ERC-165 id # // supportsInterface(bytes4): 0x8564090700000000000000000000000000000000000000000000000000000000 -> true # the deposit interface id # // get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e -// gas irOptimized: 104399 +// gas irOptimized: 104382 // gas legacy: 128065 // gas legacyOptimized: 100398 // get_deposit_count() -> 0x20, 8, 0 # TODO: check balance and logs after each deposit # // deposit(bytes,bytes,bytes,bytes32), 32 ether: 0 -> FAILURE # Empty input # // get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e -// gas irOptimized: 104399 +// gas irOptimized: 104382 // gas legacy: 128065 // gas legacyOptimized: 100398 // get_deposit_count() -> 0x20, 8, 0 // deposit(bytes,bytes,bytes,bytes32), 1 ether: 0x80, 0xe0, 0x120, 0xaa4a8d0b7d9077248630f1a4701ae9764e42271d7f22b7838778411857fd349e, 0x30, 0x933ad9491b62059dd065b560d256d8957a8c402cc6e8d8ee7290ae11e8f73292, 0x67a8811c397529dac52ae1342ba58c9500000000000000000000000000000000, 0x20, 0x00f50428677c60f997aadeab24aabf7fceaef491c96a52b463ae91f95611cf71, 0x60, 0xa29d01cc8c6296a8150e515b5995390ef841dc18948aa3e79be6d7c1851b4cbb, 0x5d6ff49fa70b9c782399506a22a85193151b9b691245cebafd2063012443c132, 0x4b6c36debaedefb7b2d71b0503ffdc00150aaffd42e63358238ec888901738b8 -> # txhash: 0x7085c586686d666e8bb6e9477a0f0b09565b2060a11f1c4209d3a52295033832 # // get_deposit_root() -> 0x2089653123d9c721215120b6db6738ba273bbc5228ac093b1f983badcdc8a438 -// gas irOptimized: 104403 +// gas irOptimized: 104386 // gas legacy: 128075 // gas legacyOptimized: 100411 // get_deposit_count() -> 0x20, 8, 0x0100000000000000000000000000000000000000000000000000000000000000 // deposit(bytes,bytes,bytes,bytes32), 32 ether: 0x80, 0xe0, 0x120, 0xdbd986dc85ceb382708cf90a3500f500f0a393c5ece76963ac3ed72eccd2c301, 0x30, 0xb2ce0f79f90e7b3a113ca5783c65756f96c4b4673c2b5c1eb4efc22280259441, 0x06d601211e8866dc5b50dc48a244dd7c00000000000000000000000000000000, 0x20, 0x00344b6c73f71b11c56aba0d01b7d8ad83559f209d0a4101a515f6ad54c89771, 0x60, 0x945caaf82d18e78c033927d51f452ebcd76524497b91d7a11219cb3db6a1d369, 0x7595fc095ce489e46b2ef129591f2f6d079be4faaf345a02c5eb133c072e7c56, 0x0c6c3617eee66b4b878165c502357d49485326bc6b31bc96873f308c8f19c09d -> # txhash: 0x404d8e109822ce448e68f45216c12cb051b784d068fbe98317ab8e50c58304ac # // get_deposit_root() -> 0x40255975859377d912c53aa853245ebd939bdd2b33a28e084babdcc1ed8238ee -// gas irOptimized: 104403 +// gas irOptimized: 104386 // gas legacy: 128075 // gas legacyOptimized: 100411 // get_deposit_count() -> 0x20, 8, 0x0200000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/externalContracts/snark.sol b/test/libsolidity/semanticTests/externalContracts/snark.sol index 6811f3e0d..323f065e2 100644 --- a/test/libsolidity/semanticTests/externalContracts/snark.sol +++ b/test/libsolidity/semanticTests/externalContracts/snark.sol @@ -296,6 +296,6 @@ contract Test { // g() -> true // pair() -> true // verifyTx() -> true -// gas irOptimized: 127891 +// gas irOptimized: 127916 // gas legacy: 130571 // gas legacyOptimized: 100147 diff --git a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol index e0794cede..ed3a86c96 100644 --- a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol +++ b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol @@ -20,7 +20,7 @@ contract test { // compileViaYul: also // ---- // set(uint8,uint8,uint8,uint8,uint8): 1, 21, 22, 42, 43 -> 0, 0, 0, 0 -// gas irOptimized: 109912 +// gas irOptimized: 109814 // gas legacy: 111406 // gas legacyOptimized: 107981 // get(uint8): 1 -> 21, 22, 42, 43 diff --git a/test/libsolidity/semanticTests/functionTypes/store_function.sol b/test/libsolidity/semanticTests/functionTypes/store_function.sol index d6e6cac75..d625c76ba 100644 --- a/test/libsolidity/semanticTests/functionTypes/store_function.sol +++ b/test/libsolidity/semanticTests/functionTypes/store_function.sol @@ -28,6 +28,6 @@ contract C { // compileViaYul: also // ---- // t() -> 9 -// gas irOptimized: 103930 +// gas irOptimized: 103946 // gas legacy: 161097 -// gas legacyOptimized: 111516 +// gas legacyOptimized: 112116 diff --git a/test/libsolidity/semanticTests/immutable/multi_creation.sol b/test/libsolidity/semanticTests/immutable/multi_creation.sol index 03e1e7c6a..0f4e3b44b 100644 --- a/test/libsolidity/semanticTests/immutable/multi_creation.sol +++ b/test/libsolidity/semanticTests/immutable/multi_creation.sol @@ -29,7 +29,7 @@ contract C { // compileViaYul: also // ---- // f() -> 3, 7, 5 -// gas irOptimized: 131345 +// gas irOptimized: 131350 // gas legacy: 153990 // gas legacyOptimized: 127822 // x() -> 7 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol index d803fe3f8..ddc88fe9d 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol @@ -27,4 +27,4 @@ contract B { // g() -> 42 // gas irOptimized: 119646 // gas legacy: 180597 -// gas legacyOptimized: 116351 +// gas legacyOptimized: 117351 diff --git a/test/libsolidity/semanticTests/interface_inheritance_conversions.sol b/test/libsolidity/semanticTests/interface_inheritance_conversions.sol index 7ef932fc5..8cd65d9bd 100644 --- a/test/libsolidity/semanticTests/interface_inheritance_conversions.sol +++ b/test/libsolidity/semanticTests/interface_inheritance_conversions.sol @@ -39,8 +39,8 @@ contract C { // convertParent() -> 1 // gas irOptimized: 103625 // convertSubA() -> 1, 2 -// gas irOptimized: 105700 +// gas irOptimized: 105708 // gas legacy: 101703 // convertSubB() -> 1, 3 -// gas irOptimized: 105634 +// gas irOptimized: 105642 // gas legacy: 101637 diff --git a/test/libsolidity/semanticTests/salted_create/salted_create.sol b/test/libsolidity/semanticTests/salted_create/salted_create.sol index be2d7bf35..d73b25dd6 100644 --- a/test/libsolidity/semanticTests/salted_create/salted_create.sol +++ b/test/libsolidity/semanticTests/salted_create/salted_create.sol @@ -22,6 +22,6 @@ contract A { // ---- // different_salt() -> true // same_salt() -> true -// gas irOptimized: 98438966 +// gas irOptimized: 98438968 // gas legacy: 98439116 // gas legacyOptimized: 98438970 diff --git a/test/libsolidity/semanticTests/structs/struct_copy.sol b/test/libsolidity/semanticTests/structs/struct_copy.sol index 4753c00f6..4409571a4 100644 --- a/test/libsolidity/semanticTests/structs/struct_copy.sol +++ b/test/libsolidity/semanticTests/structs/struct_copy.sol @@ -38,12 +38,12 @@ contract c { // compileViaYul: also // ---- // set(uint256): 7 -> true -// gas irOptimized: 101844 +// gas irOptimized: 101849 // gas legacy: 102216 // gas legacyOptimized: 101606 // retrieve(uint256): 7 -> 1, 3, 4, 2 // copy(uint256,uint256): 7, 8 -> true -// gas irOptimized: 105161 +// gas irOptimized: 105169 // gas legacy: 105566 // gas legacyOptimized: 105022 // retrieve(uint256): 7 -> 1, 3, 4, 2 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol index b74ad6fd7..a5bc43be5 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol @@ -33,4 +33,4 @@ contract C { // compileViaYul: true // ---- // f() -> 0, 0, 0 -// gas irOptimized: 124955 +// gas irOptimized: 124110 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol index 52ab5a8cf..ab2f82db8 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol @@ -27,4 +27,4 @@ contract C { // compileViaYul: true // ---- // f() -> 0 -// gas irOptimized: 118047 +// gas irOptimized: 118035 diff --git a/test/libsolidity/semanticTests/structs/structs.sol b/test/libsolidity/semanticTests/structs/structs.sol index 83ce279c1..36a6589ca 100644 --- a/test/libsolidity/semanticTests/structs/structs.sol +++ b/test/libsolidity/semanticTests/structs/structs.sol @@ -32,7 +32,7 @@ contract test { // ---- // check() -> false // set() -> -// gas irOptimized: 128462 +// gas irOptimized: 128459 // gas legacy: 129577 // gas legacyOptimized: 126964 // check() -> true diff --git a/test/libsolidity/semanticTests/various/destructuring_assignment.sol b/test/libsolidity/semanticTests/various/destructuring_assignment.sol index 447ff1a56..9d2413c2d 100644 --- a/test/libsolidity/semanticTests/various/destructuring_assignment.sol +++ b/test/libsolidity/semanticTests/various/destructuring_assignment.sol @@ -38,4 +38,4 @@ contract C { // f(bytes): 0x20, 0x5, "abcde" -> 0 // gas irOptimized: 241858 // gas legacy: 239258 -// gas legacyOptimized: 238577 +// gas legacyOptimized: 238582 diff --git a/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol b/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol index ffd88c092..1f16c1c2a 100644 --- a/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol +++ b/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol @@ -22,6 +22,6 @@ contract C { // compileViaYul: also // ---- // g() -> 2, 6 -// gas irOptimized: 169843 +// gas irOptimized: 169848 // gas legacy: 172490 // gas legacyOptimized: 171209 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol index 6aacded94..a271622d3 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol @@ -18,7 +18,7 @@ contract C { // ---- // test_indices(uint256): 1 -> // test_indices(uint256): 129 -> -// gas irOptimized: 3456682 +// gas irOptimized: 3457322 // gas legacy: 3340105 // gas legacyOptimized: 3280773 // test_indices(uint256): 5 -> @@ -27,13 +27,13 @@ contract C { // gas legacyOptimized: 455849 // test_indices(uint256): 10 -> // test_indices(uint256): 15 -> -// gas irOptimized: 110410 +// gas irOptimized: 110435 // test_indices(uint256): 0xFF -> -// gas irOptimized: 4336990 +// gas irOptimized: 4338190 // gas legacy: 4107867 // gas legacyOptimized: 3991807 // test_indices(uint256): 1000 -> -// gas irOptimized: 21236892 +// gas irOptimized: 21240617 // gas legacy: 20360399 // gas legacyOptimized: 19921344 // test_indices(uint256): 129 -> diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol index d701f9b55..24c751472 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol @@ -18,11 +18,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: 676497 +// gas irOptimized: 677730 // gas legacy: 648515 // gas legacyOptimized: 628739 // test_boundary_check(uint256,uint256): 256, 255 -> 0 -// gas irOptimized: 677515 +// gas irOptimized: 678750 // gas legacy: 649549 // gas legacyOptimized: 629633 // test_boundary_check(uint256,uint256): 256, 0xFFFF -> FAILURE, hex"4e487b71", 0x32 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol index 0f7c97be6..e650bb15c 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol @@ -54,18 +54,18 @@ contract C { // ---- // test_zeroed_indicies(uint256): 1 -> // test_zeroed_indicies(uint256): 5 -> -// gas irOptimized: 208617 +// gas irOptimized: 198357 // gas legacy: 191267 // gas legacyOptimized: 188486 // test_zeroed_indicies(uint256): 10 -> -// gas irOptimized: 304639 +// gas irOptimized: 289249 // gas legacy: 276129 // gas legacyOptimized: 271024 // test_zeroed_indicies(uint256): 15 -> -// gas irOptimized: 377949 +// gas irOptimized: 358284 // gas legacy: 339254 // gas legacyOptimized: 331904 // test_zeroed_indicies(uint256): 0xFF -> -// gas irOptimized: 9234149 +// gas irOptimized: 8808359 // gas legacy: 8477449 // gas legacyOptimized: 8343774 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol index 4d6f2fbac..73e3c6b5d 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol @@ -13,11 +13,11 @@ contract C { // compileViaYul: also // ---- // pushEmpty(uint256): 128 -// gas irOptimized: 629616 +// gas irOptimized: 630896 // gas legacy: 607287 // gas legacyOptimized: 589048 // pushEmpty(uint256): 256 -// gas irOptimized: 859120 +// gas irOptimized: 861040 // gas legacy: 828983 // gas legacyOptimized: 802808 // pushEmpty(uint256): 32768 -> FAILURE # out-of-gas # diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol index be7d0ad82..73797e552 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol @@ -18,15 +18,15 @@ contract C { // set_get_length(uint256): 10 -> 10 // set_get_length(uint256): 20 -> 20 // set_get_length(uint256): 0 -> 0 -// gas irOptimized: 109979 +// gas irOptimized: 110079 // gas legacy: 107830 // gas legacyOptimized: 107262 // set_get_length(uint256): 0xFF -> 0xFF -// gas irOptimized: 700231 +// gas irOptimized: 701506 // gas legacy: 882337 // gas legacyOptimized: 650704 // set_get_length(uint256): 0xFFF -> 0xFFF -// gas irOptimized: 10207663 +// gas irOptimized: 10226863 // gas legacy: 12945874 // gas legacyOptimized: 9462646 // set_get_length(uint256): 0xFFFF -> FAILURE # Out-of-gas # diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol index 30643d2c6..b78a5d2f0 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol @@ -15,15 +15,15 @@ contract C { // set_get_length(uint256): 1 -> 0 // set_get_length(uint256): 10 -> 0 // set_get_length(uint256): 20 -> 0 -// gas irOptimized: 162305 +// gas irOptimized: 162505 // gas legacy: 141922 // gas legacyOptimized: 139708 // set_get_length(uint256): 0xFF -> 0 -// gas irOptimized: 1787800 +// gas irOptimized: 1790350 // gas legacy: 1524427 // gas legacyOptimized: 1500358 // set_get_length(uint256): 0xFFF -> 0 -// gas irOptimized: 28349092 +// gas irOptimized: 28390042 // gas legacy: 24115159 // gas legacyOptimized: 23733970 // set_get_length(uint256): 0xFFFF -> FAILURE # Out-of-gas # diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/unassigned_return.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/unassigned_return.yul index bdb54d955..35891b459 100644 --- a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/unassigned_return.yul +++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/unassigned_return.yul @@ -18,7 +18,7 @@ // sstore(a, a) // function f() -> x // { -// let y := x -// mstore(x, 7) +// let y := 0 +// mstore(y, 7) // } // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul index 2de7b4a67..bba7cf26e 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul @@ -10,5 +10,5 @@ // { // sstore(sub(f(), f()), 8) // function f() -> a -// { mstore(a, 1) } +// { mstore(0, 1) } // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/pop_byte_shr_func.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/pop_byte_shr_func.yul index 002d8f28e..e1ec04ad1 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/pop_byte_shr_func.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/pop_byte_shr_func.yul @@ -11,5 +11,5 @@ // pop(f()) // mstore(0, 0) // function f() -> x -// { mstore(x, 1337) } +// { mstore(0, 1337) } // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/return_vars_zero.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/return_vars_zero.yul index de740fc22..ca31e7613 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/return_vars_zero.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/return_vars_zero.yul @@ -12,5 +12,5 @@ // { // let t, v := f() // function f() -> c, d -// { sstore(d, 7) } +// { sstore(0, 7) } // } diff --git a/test/libyul/yulOptimizerTests/fullSuite/abi2.yul b/test/libyul/yulOptimizerTests/fullSuite/abi2.yul index acef62cc5..d8c8e9055 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/abi2.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/abi2.yul @@ -1089,21 +1089,21 @@ // } // function abi_decode_addresst_uint256t_bytes_calldatat_enum_Operation(headStart, dataEnd) -> value0, value1, value2, value3, value4 // { -// if slt(sub(dataEnd, headStart), 128) { revert(value4, value4) } +// if slt(sub(dataEnd, headStart), 128) { revert(0, 0) } // value0 := and(calldataload(headStart), sub(shl(160, 1), 1)) // value1 := calldataload(add(headStart, 32)) // let offset := calldataload(add(headStart, 64)) // let _1 := 0xffffffffffffffff -// if gt(offset, _1) { revert(value4, value4) } +// if gt(offset, _1) { revert(0, 0) } // let _2 := add(headStart, offset) -// if iszero(slt(add(_2, 0x1f), dataEnd)) { revert(value4, value4) } +// if iszero(slt(add(_2, 0x1f), dataEnd)) { revert(0, 0) } // let length := calldataload(_2) -// if gt(length, _1) { revert(value4, value4) } -// if gt(add(add(_2, length), 32), dataEnd) { revert(value4, value4) } +// if gt(length, _1) { revert(0, 0) } +// if gt(add(add(_2, length), 32), dataEnd) { revert(0, 0) } // value2 := add(_2, 32) // value3 := length // let _3 := calldataload(add(headStart, 96)) -// if iszero(lt(_3, 3)) { revert(value4, value4) } +// if iszero(lt(_3, 3)) { revert(0, 0) } // value4 := _3 // } // function abi_encode_bytes32_address_uint256_bytes32_enum_Operation_uint256_uint256_uint256_address_address_uint256(headStart, value10, value9, value8, value7, value6, value5, value4, value3, value2, value1, value0) -> tail diff --git a/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul b/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul index 7934c39fd..b69d19cdb 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul @@ -494,7 +494,7 @@ // function abi_decode_array_array_uint256_memory_dyn(offset, end) -> array // { // let _1 := 0x1f -// if iszero(slt(add(offset, _1), end)) { revert(array, array) } +// if iszero(slt(add(offset, _1), end)) { revert(0, 0) } // let length := calldataload(offset) // array := allocateMemory(array_allocation_size_array_address_dyn_memory(length)) // let dst := array @@ -526,23 +526,23 @@ // } // function abi_decode_uint256t_uint256t_array_uint256_dynt_array_array_uint256_memory_dyn(headStart, dataEnd) -> value0, value1, value2, value3 // { -// if slt(sub(dataEnd, headStart), 128) { revert(value2, value2) } +// if slt(sub(dataEnd, headStart), 128) { revert(0, 0) } // value0 := calldataload(headStart) // let _1 := 32 // value1 := calldataload(add(headStart, _1)) // let offset := calldataload(add(headStart, 64)) // let _2 := 0xffffffffffffffff -// if gt(offset, _2) { revert(value2, value2) } +// if gt(offset, _2) { revert(0, 0) } // let _3 := add(headStart, offset) -// if iszero(slt(add(_3, 0x1f), dataEnd)) { revert(value2, value2) } +// if iszero(slt(add(_3, 0x1f), dataEnd)) { revert(0, 0) } // let length := calldataload(_3) // let dst := allocateMemory(array_allocation_size_array_address_dyn_memory(length)) // let dst_1 := dst // mstore(dst, length) // dst := add(dst, _1) // let src := add(_3, _1) -// if gt(add(add(_3, shl(5, length)), _1), dataEnd) { revert(value2, value2) } -// let i := value2 +// if gt(add(add(_3, shl(5, length)), _1), dataEnd) { revert(0, 0) } +// let i := 0 // for { } lt(i, length) { i := add(i, 1) } // { // mstore(dst, calldataload(src)) @@ -551,7 +551,7 @@ // } // value2 := dst_1 // let offset_1 := calldataload(add(headStart, 96)) -// if gt(offset_1, _2) { revert(value3, value3) } +// if gt(offset_1, _2) { revert(0, 0) } // value3 := abi_decode_array_array_uint256_memory_dyn(add(headStart, offset_1), dataEnd) // } // function allocateMemory_967() -> memPtr @@ -570,7 +570,7 @@ // } // function array_allocation_size_array_address_dyn_memory(length) -> size // { -// if gt(length, 0xffffffffffffffff) { revert(size, size) } +// if gt(length, 0xffffffffffffffff) { revert(0, 0) } // size := add(shl(5, length), 0x20) // } // } diff --git a/test/libyul/yulOptimizerTests/fullSuite/reserved_identifiers.yul b/test/libyul/yulOptimizerTests/fullSuite/reserved_identifiers.yul index 40bcbd64a..e8ddcf985 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/reserved_identifiers.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/reserved_identifiers.yul @@ -26,7 +26,7 @@ // } // function datasize_(x) -> linkersymbol_ // { -// if calldataload(linkersymbol_) { linkersymbol_ := datasize_(x) } +// if calldataload(0) { linkersymbol_ := datasize_(x) } // sstore(linkersymbol_, calldataload(linkersymbol_)) // } // } diff --git a/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul b/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul index 38fb86d27..427c9166b 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul @@ -47,9 +47,9 @@ // } // function abi_decode_bytes_calldata(offset, end) -> arrayPos, length // { -// if iszero(slt(add(offset, 0x1f), end)) { revert(arrayPos, arrayPos) } +// if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) } // length := calldataload(offset) -// if gt(length, 0xffffffffffffffff) { revert(arrayPos, arrayPos) } +// if gt(length, 0xffffffffffffffff) { revert(0, 0) } // arrayPos := add(offset, 0x20) // if gt(add(add(offset, length), 0x20), end) { revert(0, 0) } // } diff --git a/test/libyul/yulOptimizerTests/ssaAndBack/ssaReverse.yul b/test/libyul/yulOptimizerTests/ssaAndBack/ssaReverse.yul index 56f0278ce..0ef0ffee3 100644 --- a/test/libyul/yulOptimizerTests/ssaAndBack/ssaReverse.yul +++ b/test/libyul/yulOptimizerTests/ssaAndBack/ssaReverse.yul @@ -28,15 +28,9 @@ // mstore(a, b) // function abi_decode_t_bytes_calldata_ptr(offset_12, end_13) -> arrayPos_14, length_15 // { -// if iszero(slt(add(offset_12, 0x1f), end_13)) -// { -// revert(arrayPos_14, arrayPos_14) -// } +// if iszero(slt(add(offset_12, 0x1f), end_13)) { revert(0, 0) } // length_15 := calldataload(offset_12) -// if gt(length_15, 0xffffffffffffffff) -// { -// revert(arrayPos_14, arrayPos_14) -// } +// if gt(length_15, 0xffffffffffffffff) { revert(0, 0) } // arrayPos_14 := add(offset_12, 0x20) // if gt(add(add(offset_12, length_15), 0x20), end_13) { revert(0, 0) } // }