From 6fc4b04d1d38439f367d8e07c530d4d14b37dd5d Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Tue, 9 Mar 2021 16:42:47 +0100 Subject: [PATCH] Update test expectations. --- .../abi_encode_calldata_slice.sol | 2 +- .../abi_encode_calldata_slice.sol | 2 +- test/libyul/CompilabilityChecker.cpp | 6 +- .../stackReuse/function_argument_reuse.yul | 10 +- .../stackReuse/function_many_arguments.yul | 93 ++++++++++++++++++- .../stackReuse/function_retparam_block.yul | 2 +- .../function_retparam_declaration.yul | 2 +- .../stackReuse/function_retparam_for.yul | 2 +- .../stackReuse/function_retparam_if.yul | 2 +- .../stackReuse/function_retparam_leave.yul | 2 +- .../stackReuse/function_retparam_read.yul | 2 +- .../function_retparam_unassigned.yul | 2 +- .../function_retparam_unassigned_multiple.yul | 6 +- .../function_with_body_embedded.yul | 12 +-- 14 files changed, 117 insertions(+), 28 deletions(-) diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol index f273da760..2371c2b7e 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol @@ -62,7 +62,7 @@ contract C { // test_bytes() -> // gas irOptimized: 511133 // gas legacy: 466763 -// gas legacyOptimized: 374537 +// gas legacyOptimized: 374591 // test_uint256() -> // gas irOptimized: 706775 // gas legacy: 634592 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol index 7dc808d53..dbfec1430 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol @@ -63,7 +63,7 @@ contract C { // test_bytes() -> // gas irOptimized: 511133 // gas legacy: 466763 -// gas legacyOptimized: 374537 +// gas legacyOptimized: 374591 // test_uint256() -> // gas irOptimized: 706775 // gas legacy: 634592 diff --git a/test/libyul/CompilabilityChecker.cpp b/test/libyul/CompilabilityChecker.cpp index 298dee563..b27f7ab54 100644 --- a/test/libyul/CompilabilityChecker.cpp +++ b/test/libyul/CompilabilityChecker.cpp @@ -170,7 +170,7 @@ BOOST_AUTO_TEST_CASE(multiple_functions_used_arguments) x := add(add(add(add(add(add(add(add(add(add(add(add(x, r12), r11), r10), r9), r8), r7), r6), r5), r4), r3), r2), r1) } })"); - BOOST_CHECK_EQUAL(out, "h: 9 g: 3 f: 5 "); + BOOST_CHECK_EQUAL(out, "h: 9 g: 5 f: 5 "); } BOOST_AUTO_TEST_CASE(multiple_functions_unused_arguments) @@ -238,7 +238,7 @@ BOOST_AUTO_TEST_CASE(nested_used_arguments) x := add(add(add(add(add(add(add(add(add(add(add(add(x, r12), r11), r10), r9), r8), r7), r6), r5), r4), r3), r2), r1) } })"); - BOOST_CHECK_EQUAL(out, "h: 9 g: 3 f: 5 "); + BOOST_CHECK_EQUAL(out, "h: 9 g: 5 f: 5 "); } @@ -303,7 +303,7 @@ BOOST_AUTO_TEST_CASE(also_in_outer_block_used_arguments) sstore(s1, s2) } })"); - BOOST_CHECK_EQUAL(out, "g: 3 : 9 "); + BOOST_CHECK_EQUAL(out, "g: 5 : 9 "); } BOOST_AUTO_TEST_CASE(also_in_outer_block_unused_arguments) diff --git a/test/libyul/evmCodeTransform/stackReuse/function_argument_reuse.yul b/test/libyul/evmCodeTransform/stackReuse/function_argument_reuse.yul index 7ef71fb93..13048c020 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_argument_reuse.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_argument_reuse.yul @@ -7,21 +7,21 @@ // PUSH1 0x17 // JUMP // JUMPDEST -// PUSH1 0x0 // ADDRESS // POP -// DUP4 // DUP3 +// DUP2 // SSTORE +// POP // CALLVALUE // POP -// DUP3 +// PUSH1 0x0 +// DUP2 // SWAP1 // POP // JUMPDEST -// SWAP4 // SWAP3 -// POP +// SWAP2 // POP // POP // JUMP diff --git a/test/libyul/evmCodeTransform/stackReuse/function_many_arguments.yul b/test/libyul/evmCodeTransform/stackReuse/function_many_arguments.yul index b46cec50a..aa4567a90 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_many_arguments.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_many_arguments.yul @@ -1,5 +1,5 @@ { -/* function f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) -> x { + function f(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) -> x { mstore(0x0100, a1) mstore(0x0120, a2) mstore(0x0140, a3) @@ -20,8 +20,97 @@ mstore(0x0320, a18) mstore(0x0340, a19) x := a20 - }*/ + } } // ==== // stackOptimization: true // ---- +// PUSH1 0x80 +// JUMP +// JUMPDEST +// DUP1 +// PUSH2 0x100 +// MSTORE +// POP +// DUP1 +// PUSH2 0x120 +// MSTORE +// POP +// DUP1 +// PUSH2 0x140 +// MSTORE +// POP +// DUP1 +// PUSH2 0x160 +// MSTORE +// POP +// DUP1 +// PUSH2 0x180 +// MSTORE +// POP +// DUP1 +// PUSH2 0x1A0 +// MSTORE +// POP +// DUP1 +// PUSH2 0x1C0 +// MSTORE +// POP +// DUP1 +// PUSH2 0x1E0 +// MSTORE +// POP +// DUP1 +// PUSH2 0x200 +// MSTORE +// POP +// DUP1 +// PUSH2 0x220 +// MSTORE +// POP +// DUP1 +// PUSH2 0x240 +// MSTORE +// POP +// DUP1 +// PUSH2 0x260 +// MSTORE +// POP +// DUP1 +// PUSH2 0x280 +// MSTORE +// POP +// DUP1 +// PUSH2 0x2A0 +// MSTORE +// POP +// DUP1 +// PUSH2 0x2C0 +// MSTORE +// POP +// DUP1 +// PUSH2 0x2E0 +// MSTORE +// POP +// DUP1 +// PUSH2 0x300 +// MSTORE +// POP +// DUP1 +// PUSH2 0x320 +// MSTORE +// POP +// DUP1 +// PUSH2 0x340 +// MSTORE +// POP +// PUSH1 0x0 +// DUP2 +// SWAP1 +// POP +// JUMPDEST +// SWAP2 +// SWAP1 +// POP +// JUMP +// JUMPDEST diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_block.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_block.yul index 230884b78..3c1d90bd3 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_block.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_block.yul @@ -7,9 +7,9 @@ // PUSH1 0xD // JUMP // JUMPDEST -// PUSH1 0x0 // ADDRESS // POP +// PUSH1 0x0 // CALLVALUE // POP // JUMPDEST diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_declaration.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_declaration.yul index a5cd6440f..fe99402f4 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_declaration.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_declaration.yul @@ -7,9 +7,9 @@ // PUSH1 0xD // JUMP // JUMPDEST -// PUSH1 0x0 // ADDRESS // POP +// PUSH1 0x0 // CALLVALUE // POP // JUMPDEST diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_for.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_for.yul index dc03427ea..7dcb39c10 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_for.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_for.yul @@ -7,9 +7,9 @@ // PUSH1 0x19 // JUMP // JUMPDEST -// PUSH1 0x0 // ADDRESS // POP +// PUSH1 0x0 // CALLVALUE // POP // JUMPDEST diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_if.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_if.yul index dd435f320..bd882240f 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_if.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_if.yul @@ -7,9 +7,9 @@ // PUSH1 0x14 // JUMP // JUMPDEST -// PUSH1 0x0 // ADDRESS // POP +// PUSH1 0x0 // PUSH1 0x1 // ISZERO // PUSH1 0x10 diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_leave.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_leave.yul index c044cd324..2e16c05d5 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_leave.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_leave.yul @@ -7,9 +7,9 @@ // PUSH1 0x10 // JUMP // JUMPDEST -// PUSH1 0x0 // ADDRESS // POP +// PUSH1 0x0 // PUSH1 0xD // JUMP // CALLVALUE diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_read.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_read.yul index 022adce27..d8440b86e 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_read.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_read.yul @@ -7,9 +7,9 @@ // PUSH1 0x11 // JUMP // JUMPDEST -// PUSH1 0x0 // ADDRESS // POP +// PUSH1 0x0 // DUP1 // PUSH1 0x0 // SSTORE diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned.yul index 41d0db7c1..c20158eae 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned.yul @@ -7,9 +7,9 @@ // PUSH1 0xB // JUMP // JUMPDEST -// PUSH1 0x0 // CALLVALUE // POP +// PUSH1 0x0 // JUMPDEST // SWAP1 // JUMP diff --git a/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned_multiple.yul b/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned_multiple.yul index 54f304c0c..d9e80547e 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned_multiple.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_retparam_unassigned_multiple.yul @@ -7,11 +7,11 @@ // PUSH1 0x11 // JUMP // JUMPDEST -// PUSH1 0x0 -// PUSH1 0x0 -// PUSH1 0x0 // CALLVALUE // POP +// PUSH1 0x0 +// PUSH1 0x0 +// PUSH1 0x0 // JUMPDEST // SWAP1 // SWAP2 diff --git a/test/libyul/evmCodeTransform/stackReuse/function_with_body_embedded.yul b/test/libyul/evmCodeTransform/stackReuse/function_with_body_embedded.yul index 0f7968935..60f287734 100644 --- a/test/libyul/evmCodeTransform/stackReuse/function_with_body_embedded.yul +++ b/test/libyul/evmCodeTransform/stackReuse/function_with_body_embedded.yul @@ -14,19 +14,19 @@ // JUMP // JUMPDEST // PUSH1 0x0 -// SWAP2 -// POP -// DUP1 +// DUP2 // POP // PUSH1 0x3 +// SWAP2 +// POP +// DUP2 // SWAP1 // POP -// DUP1 +// JUMPDEST +// SWAP3 // SWAP2 // POP // POP -// JUMPDEST -// SWAP1 // JUMP // JUMPDEST // PUSH1 0x7