diff --git a/libyul/optimiser/ExpressionSplitter.cpp b/libyul/optimiser/ExpressionSplitter.cpp index 713e0e804..7657117ef 100644 --- a/libyul/optimiser/ExpressionSplitter.cpp +++ b/libyul/optimiser/ExpressionSplitter.cpp @@ -27,6 +27,8 @@ #include #include +#include +#include #include @@ -97,6 +99,16 @@ void ExpressionSplitter::outlineExpression(Expression& _expr) if (holds_alternative(_expr)) return; + // Do not split function calls with a zero (0) literal argument + // in case the PUSH0 opcode is available + if (auto&& evmDialect = dynamic_cast(&m_dialect)) + if ( + evmDialect->evmVersion().hasPush0() && + holds_alternative(_expr) && + valueOfLiteral(get(_expr)) == 0 + ) + return; + visit(_expr); shared_ptr debugData = debugDataOf(_expr); diff --git a/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output b/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output index d82d30d68..ef14a93d9 100644 --- a/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output +++ b/test/cmdlineTests/ir_with_assembly_no_memoryguard_creation/output @@ -9,9 +9,10 @@ object "D_12" { /// @src 0:115:139 "assembly { mstore(0,0) }" mstore(0, 0) /// @src 0:82:175 "contract D {..." - let _1 := datasize("D_12_deployed") - codecopy(128, dataoffset("D_12_deployed"), _1) - return(128, _1) + let _1 := mload(64) + let _2 := datasize("D_12_deployed") + codecopy(_1, dataoffset("D_12_deployed"), _2) + return(_1, _2) } } /// @use-src 0:"ir_with_assembly_no_memoryguard_creation/input.sol" diff --git a/test/cmdlineTests/keccak_optimization_deploy_code/output b/test/cmdlineTests/keccak_optimization_deploy_code/output index 5fbeed3ed..3b7bfdd5b 100644 --- a/test/cmdlineTests/keccak_optimization_deploy_code/output +++ b/test/cmdlineTests/keccak_optimization_deploy_code/output @@ -10,9 +10,10 @@ object "C_12" { mstore(0, 100) sstore(0, keccak256(0, 32)) /// @src 0:62:463 "contract C {..." - let _1 := datasize("C_12_deployed") - codecopy(128, dataoffset("C_12_deployed"), _1) - return(128, _1) + let _1 := mload(64) + let _2 := datasize("C_12_deployed") + codecopy(_1, dataoffset("C_12_deployed"), _2) + return(_1, _2) } } /// @use-src 0:"keccak_optimization_deploy_code/input.sol" diff --git a/test/cmdlineTests/name_simplifier/output b/test/cmdlineTests/name_simplifier/output index e162e313d..e60812ff5 100644 --- a/test/cmdlineTests/name_simplifier/output +++ b/test/cmdlineTests/name_simplifier/output @@ -17,105 +17,105 @@ object "C_59" { code { { /// @src 0:346:625 "contract C {..." - let _1 := memoryguard(0x80) - let _2 := 64 - mstore(_2, _1) - let _3 := 4 - if iszero(lt(calldatasize(), _3)) + let _1 := 64 + mstore(_1, memoryguard(0x80)) + let _2 := 4 + if iszero(lt(calldatasize(), _2)) { if eq(0xf8eddcc6, shr(224, calldataload(0))) { if callvalue() { revert(0, 0) } - let _4 := 32 - if slt(add(calldatasize(), not(3)), _4) { revert(0, 0) } - let offset := calldataload(_3) - let _5 := 0xffffffffffffffff - if gt(offset, _5) { revert(0, 0) } + let _3 := 32 + if slt(add(calldatasize(), not(3)), _3) { revert(0, 0) } + let offset := calldataload(_2) + let _4 := 0xffffffffffffffff + if gt(offset, _4) { revert(0, 0) } if iszero(slt(add(offset, 35), calldatasize())) { revert(0, 0) } - let _6 := calldataload(add(_3, offset)) - let _7 := 36 - if gt(_6, _5) + let _5 := calldataload(add(_2, offset)) + let _6 := 36 + if gt(_5, _4) { mstore(0, shl(224, 0x4e487b71)) - mstore(_3, 0x41) - revert(0, _7) + mstore(_2, 0x41) + revert(0, _6) } - let _8 := shl(5, _6) - let _9 := not(31) - let newFreePtr := add(_1, and(add(_8, 63), _9)) - if or(gt(newFreePtr, _5), lt(newFreePtr, _1)) + let _7 := shl(5, _5) + let memPtr := mload(_1) + let _8 := not(31) + let newFreePtr := add(memPtr, and(add(_7, 63), _8)) + if or(gt(newFreePtr, _4), lt(newFreePtr, memPtr)) { mstore(0, shl(224, 0x4e487b71)) - mstore(_3, 0x41) - revert(0, _7) + mstore(_2, 0x41) + revert(0, _6) } - mstore(_2, newFreePtr) - let dst := _1 - mstore(_1, _6) - dst := add(_1, _4) + mstore(_1, newFreePtr) + let dst := memPtr + mstore(memPtr, _5) + dst := add(memPtr, _3) let dst_1 := dst - let srcEnd := add(add(offset, _8), _7) + let srcEnd := add(add(offset, _7), _6) if gt(srcEnd, calldatasize()) { revert(0, 0) } - let src := add(offset, _7) - for { } lt(src, srcEnd) { src := add(src, _4) } + let src := add(offset, _6) + for { } lt(src, srcEnd) { src := add(src, _3) } { - if slt(sub(calldatasize(), src), _4) { revert(0, 0) } - let memPtr := mload(_2) - let newFreePtr_1 := add(memPtr, _4) - if or(gt(newFreePtr_1, _5), lt(newFreePtr_1, memPtr)) + if slt(sub(calldatasize(), src), _3) { revert(0, 0) } + let memPtr_1 := mload(_1) + let newFreePtr_1 := add(memPtr_1, _3) + if or(gt(newFreePtr_1, _4), lt(newFreePtr_1, memPtr_1)) { mstore(0, shl(224, 0x4e487b71)) - mstore(_3, 0x41) - revert(0, _7) + mstore(_2, 0x41) + revert(0, _6) } - mstore(_2, newFreePtr_1) - mstore(memPtr, calldataload(src)) - mstore(dst, memPtr) - dst := add(dst, _4) + mstore(_1, newFreePtr_1) + mstore(memPtr_1, calldataload(src)) + mstore(dst, memPtr_1) + dst := add(dst, _3) } - if iszero(mload(_1)) + if iszero(mload(memPtr)) { mstore(0, shl(224, 0x4e487b71)) - mstore(_3, 0x32) - revert(0, _7) + mstore(_2, 0x32) + revert(0, _6) } sstore(0, mload(/** @src 0:469:474 "_s[0]" */ mload(dst_1))) /// @src 0:346:625 "contract C {..." - if iszero(lt(/** @src 0:492:493 "1" */ 0x01, /** @src 0:346:625 "contract C {..." */ mload(_1))) + if iszero(lt(/** @src 0:492:493 "1" */ 0x01, /** @src 0:346:625 "contract C {..." */ mload(memPtr))) { mstore(0, shl(224, 0x4e487b71)) - mstore(_3, 0x32) - revert(0, _7) + mstore(_2, 0x32) + revert(0, _6) } - let _10 := mload(/** @src 0:489:494 "_s[1]" */ mload(/** @src 0:346:625 "contract C {..." */ add(_1, _2))) - sstore(0x02, _10) - let memPtr_1 := mload(_2) - let newFreePtr_2 := add(memPtr_1, 160) - if or(gt(newFreePtr_2, _5), lt(newFreePtr_2, memPtr_1)) + let _9 := mload(/** @src 0:489:494 "_s[1]" */ mload(/** @src 0:346:625 "contract C {..." */ add(memPtr, _1))) + sstore(0x02, _9) + let memPtr_2 := mload(_1) + let newFreePtr_2 := add(memPtr_2, 160) + if or(gt(newFreePtr_2, _4), lt(newFreePtr_2, memPtr_2)) { mstore(0, shl(224, 0x4e487b71)) - mstore(_3, 0x41) - revert(0, _7) + mstore(_2, 0x41) + revert(0, _6) } - mstore(_2, newFreePtr_2) - mstore(memPtr_1, 100) - mstore(add(memPtr_1, _4), "longstringlongstringlongstringlo") - mstore(add(memPtr_1, _2), "ngstringlongstringlongstringlong") - let _11 := 96 - mstore(add(memPtr_1, _11), "stringlongstringlongstringlongst") - mstore(add(memPtr_1, 128), "ring") - let memPos := mload(_2) - mstore(memPos, _10) - mstore(add(memPos, _4), _2) - let length := mload(memPtr_1) - mstore(add(memPos, _2), length) + mstore(_1, newFreePtr_2) + mstore(memPtr_2, 100) + mstore(add(memPtr_2, _3), "longstringlongstringlongstringlo") + mstore(add(memPtr_2, _1), "ngstringlongstringlongstringlong") + let _10 := 96 + mstore(add(memPtr_2, _10), "stringlongstringlongstringlongst") + mstore(add(memPtr_2, 128), "ring") + let memPos := mload(_1) + mstore(memPos, _9) + mstore(add(memPos, _3), _1) + let length := mload(memPtr_2) + mstore(add(memPos, _1), length) let i := 0 - for { } lt(i, length) { i := add(i, _4) } + for { } lt(i, length) { i := add(i, _3) } { - mstore(add(add(memPos, i), _11), mload(add(add(memPtr_1, i), _4))) + mstore(add(add(memPos, i), _10), mload(add(add(memPtr_2, i), _3))) } - mstore(add(add(memPos, length), _11), 0) - return(memPos, add(sub(add(memPos, and(add(length, 31), _9)), memPos), _11)) + mstore(add(add(memPos, length), _10), 0) + return(memPos, add(sub(add(memPos, and(add(length, 31), _8)), memPos), _10)) } } revert(0, 0) diff --git a/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json b/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json index 1c2cf2f30..5d731f49e 100644 --- a/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json +++ b/test/cmdlineTests/standard_debug_info_in_evm_asm_via_ir_location/output.json @@ -84,11 +84,9 @@ stop sub_0: assembly { /* \"C\":79:428 contract C... */ - 0x80 0x40 - swap1 - dup1 - dup3 + 0x80 + dup2 mstore jumpi(tag_2, iszero(lt(calldatasize, 0x04))) 0x00 @@ -96,13 +94,11 @@ sub_0: assembly { revert tag_2: shr(0xe0, calldataload(0x00)) - swap1 - dup2 + dup1 0x26121ff0 eq tag_4 jumpi - pop dup1 0x793816ec eq @@ -301,17 +297,17 @@ sub_0: assembly { mstore return tag_4: + pop jumpi(tag_26, callvalue) jumpi(tag_26, slt(add(not(0x03), calldatasize), 0x00)) /* \"C\":290:298 immutVar */ immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":117:119 41 */ - swap1 - dup2 + dup1 0x29 add - swap2 - dup3 + swap1 + dup2 slt 0x01 and @@ -320,6 +316,8 @@ sub_0: assembly { /* \"C\":79:428 contract C... */ 0x20 swap2 + mload + swap1 dup2 mstore return @@ -460,11 +458,9 @@ stop sub_0: assembly { /* \"D\":91:166 contract D is C(3)... */ - 0x80 0x40 - swap1 - dup1 - dup3 + 0x80 + dup2 mstore jumpi(tag_2, iszero(lt(calldatasize, 0x04))) 0x00 @@ -472,13 +468,11 @@ sub_0: assembly { revert tag_2: shr(0xe0, calldataload(0x00)) - swap1 - dup2 + dup1 0x26121ff0 eq tag_4 jumpi - pop dup1 0x793816ec eq @@ -677,17 +671,17 @@ sub_0: assembly { mstore return tag_4: + pop jumpi(tag_26, callvalue) jumpi(tag_26, slt(add(not(0x03), calldatasize), 0x00)) /* \"C\":290:298 immutVar */ immutable(\"0xe4b1702d9298fee62dfeccc57d322a463ad55ca201256d01f62b45b2e1c21c10\") /* \"C\":117:119 41 */ - swap1 - dup2 + dup1 0x29 add - swap2 - dup3 + swap1 + dup2 slt 0x01 and @@ -696,6 +690,8 @@ sub_0: assembly { /* \"D\":91:166 contract D is C(3)... */ 0x20 swap2 + mload + swap1 dup2 mstore return diff --git a/test/cmdlineTests/standard_debug_info_in_yul_location/output.json b/test/cmdlineTests/standard_debug_info_in_yul_location/output.json index c3a23fc49..015d64870 100644 --- a/test/cmdlineTests/standard_debug_info_in_yul_location/output.json +++ b/test/cmdlineTests/standard_debug_info_in_yul_location/output.json @@ -650,9 +650,8 @@ object \"C_54\" { code { { /// @src 0:79:435 \"contract C...\" - let _1 := memoryguard(0x80) - let _2 := 64 - mstore(_2, _1) + let _1 := 64 + mstore(_1, memoryguard(0x80)) if iszero(lt(calldatasize(), 4)) { switch shr(224, calldataload(0)) @@ -660,91 +659,92 @@ object \"C_54\" { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } /// @src 0:297:305 \"immutVar\" - let _3 := loadimmutable(\"8\") + let _2 := loadimmutable(\"8\") /// @src 0:79:435 \"contract C...\" - let sum := add(/** @src 0:124:126 \"41\" */ 0x29, /** @src 0:79:435 \"contract C...\" */ _3) - if and(1, slt(sum, _3)) + let sum := add(/** @src 0:124:126 \"41\" */ 0x29, /** @src 0:79:435 \"contract C...\" */ _2) + if and(1, slt(sum, _2)) { mstore(0, shl(224, 0x4e487b71)) mstore(4, 0x11) revert(0, 0x24) } - mstore(_1, sum) - return(_1, 32) + let memPos := mload(_1) + mstore(memPos, sum) + return(memPos, 32) } case 0x793816ec { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } - let _4 := sload(/** @src 0:159:178 \"int public stateVar\" */ 0) + let _3 := sload(/** @src 0:159:178 \"int public stateVar\" */ 0) /// @src 0:79:435 \"contract C...\" - let memPos := mload(_2) - mstore(memPos, _4) - return(memPos, 32) + let memPos_1 := mload(_1) + mstore(memPos_1, _3) + return(memPos_1, 32) } case 0x9942ec6f { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } - let _5 := sload(/** @src 0:329:339 \"stateVar++\" */ 0x00) + let _4 := sload(/** @src 0:329:339 \"stateVar++\" */ 0x00) /// @src 0:79:435 \"contract C...\" - if eq(_5, sub(shl(255, 1), 1)) + if eq(_4, sub(shl(255, 1), 1)) { mstore(0, shl(224, 0x4e487b71)) mstore(4, 0x11) revert(0, 0x24) } - sstore(/** @src 0:329:339 \"stateVar++\" */ 0x00, /** @src 0:79:435 \"contract C...\" */ add(_5, 1)) - let _6 := sload(/** @src 0:399:407 \"stateVar\" */ 0x00) + sstore(/** @src 0:329:339 \"stateVar++\" */ 0x00, /** @src 0:79:435 \"contract C...\" */ add(_4, 1)) + let _5 := sload(/** @src 0:399:407 \"stateVar\" */ 0x00) /// @src 0:410:418 \"this.f()\" - let _7 := /** @src 0:79:435 \"contract C...\" */ mload(_2) + let _6 := /** @src 0:79:435 \"contract C...\" */ mload(_1) /// @src 0:410:418 \"this.f()\" - mstore(_7, /** @src 0:79:435 \"contract C...\" */ shl(228, 0x026121ff)) + mstore(_6, /** @src 0:79:435 \"contract C...\" */ shl(228, 0x026121ff)) /// @src 0:410:418 \"this.f()\" - let _8 := staticcall(gas(), /** @src 0:410:414 \"this\" */ address(), /** @src 0:410:418 \"this.f()\" */ _7, /** @src 0:79:435 \"contract C...\" */ 4, /** @src 0:410:418 \"this.f()\" */ _7, 32) - if iszero(_8) + let _7 := staticcall(gas(), /** @src 0:410:414 \"this\" */ address(), /** @src 0:410:418 \"this.f()\" */ _6, /** @src 0:79:435 \"contract C...\" */ 4, /** @src 0:410:418 \"this.f()\" */ _6, 32) + if iszero(_7) { /// @src 0:79:435 \"contract C...\" - let pos := mload(_2) + let pos := mload(_1) returndatacopy(pos, 0, returndatasize()) revert(pos, returndatasize()) } /// @src 0:410:418 \"this.f()\" let expr := /** @src -1:-1:-1 */ 0 /// @src 0:410:418 \"this.f()\" - if _8 + if _7 { - let _9 := 32 - if gt(_9, returndatasize()) { _9 := returndatasize() } + let _8 := 32 + if gt(_8, returndatasize()) { _8 := returndatasize() } /// @src 0:79:435 \"contract C...\" - let newFreePtr := add(_7, and(add(_9, 31), not(31))) - if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, _7)) + let newFreePtr := add(_6, and(add(_8, 31), not(31))) + if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, _6)) { mstore(0, shl(224, 0x4e487b71)) mstore(4, 0x41) revert(0, 0x24) } - mstore(_2, newFreePtr) - if slt(sub(/** @src 0:410:418 \"this.f()\" */ add(_7, _9), /** @src 0:79:435 \"contract C...\" */ _7), /** @src 0:410:418 \"this.f()\" */ 32) + mstore(_1, newFreePtr) + if slt(sub(/** @src 0:410:418 \"this.f()\" */ add(_6, _8), /** @src 0:79:435 \"contract C...\" */ _6), /** @src 0:410:418 \"this.f()\" */ 32) /// @src 0:79:435 \"contract C...\" { revert(0, 0) } /// @src 0:410:418 \"this.f()\" - expr := /** @src 0:79:435 \"contract C...\" */ mload(_7) + expr := /** @src 0:79:435 \"contract C...\" */ mload(_6) } /// @src 0:399:418 \"stateVar + this.f()\" - let expr_1 := checked_add_int256(_6, expr) + let expr_1 := checked_add_int256(_5, expr) /// @src 0:392:429 \"return stateVar + this.f() + immutVar\" let var := /** @src 0:399:429 \"stateVar + this.f() + immutVar\" */ checked_add_int256(expr_1, /** @src 0:421:429 \"immutVar\" */ loadimmutable(\"8\")) /// @src 0:79:435 \"contract C...\" - let memPos_1 := mload(_2) - mstore(memPos_1, var) - return(memPos_1, /** @src 0:410:418 \"this.f()\" */ 32) + let memPos_2 := mload(_1) + mstore(memPos_2, var) + return(memPos_2, /** @src 0:410:418 \"this.f()\" */ 32) } case /** @src 0:79:435 \"contract C...\" */ 0xa00b982b { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } - let memPos_2 := mload(_2) - mstore(memPos_2, /** @src 0:124:126 \"41\" */ 0x29) + let memPos_3 := mload(_1) + mstore(memPos_3, /** @src 0:124:126 \"41\" */ 0x29) /// @src 0:79:435 \"contract C...\" - return(memPos_2, 32) + return(memPos_3, 32) } } revert(0, 0) @@ -1500,9 +1500,8 @@ object \"D_72\" { code { { /// @src 1:91:166 \"contract D is C(3)...\" - let _1 := memoryguard(0x80) - let _2 := 64 - mstore(_2, _1) + let _1 := 64 + mstore(_1, memoryguard(0x80)) if iszero(lt(calldatasize(), 4)) { switch shr(224, calldataload(0)) @@ -1510,91 +1509,92 @@ object \"D_72\" { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } /// @src 0:297:305 \"immutVar\" - let _3 := loadimmutable(\"8\") + let _2 := loadimmutable(\"8\") /// @src 1:91:166 \"contract D is C(3)...\" - let sum := add(/** @src 0:124:126 \"41\" */ 0x29, /** @src 1:91:166 \"contract D is C(3)...\" */ _3) - if and(1, slt(sum, _3)) + let sum := add(/** @src 0:124:126 \"41\" */ 0x29, /** @src 1:91:166 \"contract D is C(3)...\" */ _2) + if and(1, slt(sum, _2)) { mstore(0, shl(224, 0x4e487b71)) mstore(4, 0x11) revert(0, 0x24) } - mstore(_1, sum) - return(_1, 32) + let memPos := mload(_1) + mstore(memPos, sum) + return(memPos, 32) } case 0x793816ec { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } - let _4 := sload(/** @src 0:159:178 \"int public stateVar\" */ 0) + let _3 := sload(/** @src 0:159:178 \"int public stateVar\" */ 0) /// @src 1:91:166 \"contract D is C(3)...\" - let memPos := mload(_2) - mstore(memPos, _4) - return(memPos, 32) + let memPos_1 := mload(_1) + mstore(memPos_1, _3) + return(memPos_1, 32) } case 0x9942ec6f { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } - let _5 := sload(/** @src 0:329:339 \"stateVar++\" */ 0x00) + let _4 := sload(/** @src 0:329:339 \"stateVar++\" */ 0x00) /// @src 1:91:166 \"contract D is C(3)...\" - if eq(_5, sub(shl(255, 1), 1)) + if eq(_4, sub(shl(255, 1), 1)) { mstore(0, shl(224, 0x4e487b71)) mstore(4, 0x11) revert(0, 0x24) } - sstore(/** @src 0:329:339 \"stateVar++\" */ 0x00, /** @src 1:91:166 \"contract D is C(3)...\" */ add(_5, 1)) - let _6 := sload(/** @src 0:399:407 \"stateVar\" */ 0x00) + sstore(/** @src 0:329:339 \"stateVar++\" */ 0x00, /** @src 1:91:166 \"contract D is C(3)...\" */ add(_4, 1)) + let _5 := sload(/** @src 0:399:407 \"stateVar\" */ 0x00) /// @src 0:410:418 \"this.f()\" - let _7 := /** @src 1:91:166 \"contract D is C(3)...\" */ mload(_2) + let _6 := /** @src 1:91:166 \"contract D is C(3)...\" */ mload(_1) /// @src 0:410:418 \"this.f()\" - mstore(_7, /** @src 1:91:166 \"contract D is C(3)...\" */ shl(228, 0x026121ff)) + mstore(_6, /** @src 1:91:166 \"contract D is C(3)...\" */ shl(228, 0x026121ff)) /// @src 0:410:418 \"this.f()\" - let _8 := staticcall(gas(), /** @src 0:410:414 \"this\" */ address(), /** @src 0:410:418 \"this.f()\" */ _7, /** @src 1:91:166 \"contract D is C(3)...\" */ 4, /** @src 0:410:418 \"this.f()\" */ _7, 32) - if iszero(_8) + let _7 := staticcall(gas(), /** @src 0:410:414 \"this\" */ address(), /** @src 0:410:418 \"this.f()\" */ _6, /** @src 1:91:166 \"contract D is C(3)...\" */ 4, /** @src 0:410:418 \"this.f()\" */ _6, 32) + if iszero(_7) { /// @src 1:91:166 \"contract D is C(3)...\" - let pos := mload(_2) + let pos := mload(_1) returndatacopy(pos, 0, returndatasize()) revert(pos, returndatasize()) } /// @src 0:410:418 \"this.f()\" let expr := /** @src -1:-1:-1 */ 0 /// @src 0:410:418 \"this.f()\" - if _8 + if _7 { - let _9 := 32 - if gt(_9, returndatasize()) { _9 := returndatasize() } + let _8 := 32 + if gt(_8, returndatasize()) { _8 := returndatasize() } /// @src 1:91:166 \"contract D is C(3)...\" - let newFreePtr := add(_7, and(add(_9, 31), not(31))) - if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, _7)) + let newFreePtr := add(_6, and(add(_8, 31), not(31))) + if or(gt(newFreePtr, 0xffffffffffffffff), lt(newFreePtr, _6)) { mstore(0, shl(224, 0x4e487b71)) mstore(4, 0x41) revert(0, 0x24) } - mstore(_2, newFreePtr) - if slt(sub(/** @src 0:410:418 \"this.f()\" */ add(_7, _9), /** @src 1:91:166 \"contract D is C(3)...\" */ _7), /** @src 0:410:418 \"this.f()\" */ 32) + mstore(_1, newFreePtr) + if slt(sub(/** @src 0:410:418 \"this.f()\" */ add(_6, _8), /** @src 1:91:166 \"contract D is C(3)...\" */ _6), /** @src 0:410:418 \"this.f()\" */ 32) /// @src 1:91:166 \"contract D is C(3)...\" { revert(0, 0) } /// @src 0:410:418 \"this.f()\" - expr := /** @src 1:91:166 \"contract D is C(3)...\" */ mload(_7) + expr := /** @src 1:91:166 \"contract D is C(3)...\" */ mload(_6) } /// @src 0:399:418 \"stateVar + this.f()\" - let expr_1 := checked_add_int256(_6, expr) + let expr_1 := checked_add_int256(_5, expr) /// @src 0:392:429 \"return stateVar + this.f() + immutVar\" let var := /** @src 0:399:429 \"stateVar + this.f() + immutVar\" */ checked_add_int256(expr_1, /** @src 0:421:429 \"immutVar\" */ loadimmutable(\"8\")) /// @src 1:91:166 \"contract D is C(3)...\" - let memPos_1 := mload(_2) - mstore(memPos_1, var) - return(memPos_1, /** @src 0:410:418 \"this.f()\" */ 32) + let memPos_2 := mload(_1) + mstore(memPos_2, var) + return(memPos_2, /** @src 0:410:418 \"this.f()\" */ 32) } case /** @src 1:91:166 \"contract D is C(3)...\" */ 0xa00b982b { if callvalue() { revert(0, 0) } if slt(add(calldatasize(), not(3)), 0) { revert(0, 0) } - let memPos_2 := mload(_2) - mstore(memPos_2, /** @src 0:124:126 \"41\" */ 0x29) + let memPos_3 := mload(_1) + mstore(memPos_3, /** @src 0:124:126 \"41\" */ 0x29) /// @src 1:91:166 \"contract D is C(3)...\" - return(memPos_2, 32) + return(memPos_3, 32) } } revert(0, 0) diff --git a/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol b/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol index ec23f5121..86c0a2d48 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol @@ -24,6 +24,6 @@ contract C { // ---- // library: L // f() -> 8, 7, 1, 2, 7, 12 -// gas irOptimized: 166723 +// gas irOptimized: 166726 // gas legacy: 169283 // gas legacyOptimized: 167248 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_overlapped_dynamic_arrays.sol index 3da6271db..39e918403 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: 111732 +// gas irOptimized: 111724 // 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/abiEncoderV2/storage_array_encoding.sol b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol index 53643d5d9..bc972e5a7 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol @@ -18,10 +18,10 @@ contract C { // EVMVersion: >homestead // ---- // h(uint256[2][]): 0x20, 3, 123, 124, 223, 224, 323, 324 -> 32, 256, 0x20, 3, 123, 124, 223, 224, 323, 324 -// gas irOptimized: 180889 +// gas irOptimized: 180793 // gas legacy: 184830 // gas legacyOptimized: 181493 // i(uint256[2][2]): 123, 124, 223, 224 -> 32, 128, 123, 124, 223, 224 -// gas irOptimized: 112425 +// gas irOptimized: 112417 // gas legacy: 115398 // gas legacyOptimized: 112982 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 e869bc3f6..d3304e944 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 @@ -21,6 +21,6 @@ contract c { } // ---- // test() -> 3, 4 -// gas irOptimized: 169620 +// gas irOptimized: 169618 // gas legacy: 175424 // gas legacyOptimized: 172535 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol index a4b8d1702..6cd2e076c 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol @@ -11,6 +11,6 @@ contract c { } // ---- // test() -> 9, 4 -// gas irOptimized: 123230 +// gas irOptimized: 123227 // gas legacy: 123567 // gas legacyOptimized: 123202 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_function_external_storage_to_storage_dynamic.sol b/test/libsolidity/semanticTests/array/copying/array_of_function_external_storage_to_storage_dynamic.sol index e072cc7f6..07b034e08 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_function_external_storage_to_storage_dynamic.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_function_external_storage_to_storage_dynamic.sol @@ -45,7 +45,7 @@ contract C { } // ---- // copyExternalStorageArrayOfFunctionType() -> true -// gas irOptimized: 104770 +// gas irOptimized: 104735 // gas legacy: 108554 // gas legacyOptimized: 102413 // copyInternalArrayOfFunctionType() -> true diff --git a/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol index 827e72661..3d4e3caaf 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol @@ -17,4 +17,4 @@ contract C { // compileViaYul: true // ---- // f((uint128,uint64,uint128)[]): 0x20, 3, 0, 0, 12, 0, 11, 0, 10, 0, 0 -> 10, 11, 12 -// gas irOptimized: 119937 +// gas irOptimized: 119874 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol index 187200fe4..53b543dc1 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol @@ -13,6 +13,6 @@ contract C { } // ---- // f() -> 2, 3, 4 -// gas irOptimized: 115182 +// gas irOptimized: 115241 // gas legacy: 126129 // gas legacyOptimized: 120622 diff --git a/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol b/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol index a4498bde8..c44ff3ecb 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: 219669 +// gas irOptimized: 219658 // gas legacy: 254056 // gas legacyOptimized: 246892 diff --git a/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol b/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol index cc69383dd..1e7312665 100644 --- a/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol +++ b/test/libsolidity/semanticTests/array/invalid_encoding_for_storage_byte_array.sol @@ -40,7 +40,7 @@ contract C { // copyFromStorageShort() // x() -> 0x20, 3, 0x6162630000000000000000000000000000000000000000000000000000000000 // copyFromStorageLong() -// gas irOptimized: 121087 +// gas irOptimized: 121143 // gas legacy: 121904 // gas legacyOptimized: 121398 // x() -> 0x20, 0x25, 0x3132333435363738393031323334353637383930313233343536373839303132, 0x3334353637000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/array/reusing_memory.sol b/test/libsolidity/semanticTests/array/reusing_memory.sol index 0c751ebc6..d2502bdfa 100644 --- a/test/libsolidity/semanticTests/array/reusing_memory.sol +++ b/test/libsolidity/semanticTests/array/reusing_memory.sol @@ -24,6 +24,6 @@ contract Main { } // ---- // f(uint256): 0x34 -> 0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 -// gas irOptimized: 112093 +// gas irOptimized: 112085 // gas legacy: 125162 // gas legacyOptimized: 113012 diff --git a/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol b/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol index 7600a7b58..6212d70e4 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: 424529 +// gas irOptimized: 424507 // 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 f15519990..6b5863874 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: 268926 +// gas irOptimized: 268920 // gas legacy: 418462 // gas legacyOptimized: 291760 diff --git a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol index 79f52c5b0..cc6353b01 100644 --- a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol +++ b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol @@ -18,7 +18,7 @@ contract test { } // ---- // set(uint8,uint8,uint8,uint8,uint8): 1, 21, 22, 42, 43 -> 0, 0, 0, 0 -// gas irOptimized: 111656 +// gas irOptimized: 111658 // gas legacy: 113748 // gas legacyOptimized: 111772 // get(uint8): 1 -> 21, 22, 42, 43 diff --git a/test/libsolidity/semanticTests/immutable/use_scratch.sol b/test/libsolidity/semanticTests/immutable/use_scratch.sol index f84574615..8950dd91d 100644 --- a/test/libsolidity/semanticTests/immutable/use_scratch.sol +++ b/test/libsolidity/semanticTests/immutable/use_scratch.sol @@ -15,7 +15,7 @@ contract C { } // ---- // constructor(): 3 -> -// gas irOptimized: 123554 +// gas irOptimized: 123338 // gas legacy: 197645 // gas legacyOptimized: 137678 // f() -> 84, 23 diff --git a/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol b/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol index c172dbc09..cee902860 100644 --- a/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol +++ b/test/libsolidity/semanticTests/libraries/using_library_mappings_public.sol @@ -19,6 +19,6 @@ contract Test { // ---- // library: Lib // f() -> 1, 0, 0x2a, 0x17, 0, 0x63 -// gas irOptimized: 119599 +// gas irOptimized: 119634 // gas legacy: 124674 // gas legacyOptimized: 119669 diff --git a/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol b/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol index f849f238d..44c9bb5e5 100644 --- a/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol +++ b/test/libsolidity/semanticTests/libraries/using_library_mappings_return.sol @@ -17,6 +17,6 @@ contract Test { // ---- // library: Lib // f() -> 1, 0, 0x2a, 0x17, 0, 0x63 -// gas irOptimized: 120223 +// gas irOptimized: 120235 // gas legacy: 125109 // gas legacyOptimized: 120128 diff --git a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol index 90b14ef11..d956423fa 100644 --- a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol +++ b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol @@ -21,6 +21,6 @@ contract A { // EVMVersion: >=constantinople // ---- // f(), 10 ether -> 3007, 3008, 3009 -// gas irOptimized: 253041 +// gas irOptimized: 254250 // gas legacy: 381063 // gas legacyOptimized: 279694 diff --git a/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol b/test/libsolidity/semanticTests/structs/copy_substructures_to_mapping.sol index 52a0497a7..56624cde5 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: 123113 +// gas irOptimized: 123089 // gas legacy: 130227 // gas legacyOptimized: 128761 // from_state() -> 0x20, 0x60, 0xa0, 21, 3, 0x666F6F0000000000000000000000000000000000000000000000000000000000, 2, 13, 14 -// gas irOptimized: 121780 +// gas irOptimized: 121789 // 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: 115157 +// gas irOptimized: 115151 // gas legacy: 122516 // gas legacyOptimized: 120807 diff --git a/test/libsolidity/semanticTests/structs/struct_copy.sol b/test/libsolidity/semanticTests/structs/struct_copy.sol index fc2ca2070..460f8bb48 100644 --- a/test/libsolidity/semanticTests/structs/struct_copy.sol +++ b/test/libsolidity/semanticTests/structs/struct_copy.sol @@ -35,12 +35,12 @@ contract c { } // ---- // set(uint256): 7 -> true -// gas irOptimized: 110073 +// gas irOptimized: 110062 // gas legacy: 110597 // gas legacyOptimized: 110003 // retrieve(uint256): 7 -> 1, 3, 4, 2 // copy(uint256,uint256): 7, 8 -> true -// gas irOptimized: 118590 +// gas irOptimized: 118581 // gas legacy: 119147 // gas legacyOptimized: 118619 // retrieve(uint256): 7 -> 1, 3, 4, 2 diff --git a/test/libsolidity/semanticTests/structs/structs.sol b/test/libsolidity/semanticTests/structs/structs.sol index 878b51f3f..304a9d04c 100644 --- a/test/libsolidity/semanticTests/structs/structs.sol +++ b/test/libsolidity/semanticTests/structs/structs.sol @@ -30,7 +30,7 @@ contract test { // ---- // check() -> false // set() -> -// gas irOptimized: 134439 +// gas irOptimized: 134431 // gas legacy: 135246 // gas legacyOptimized: 134062 // check() -> true diff --git a/test/libsolidity/semanticTests/various/address_code.sol b/test/libsolidity/semanticTests/various/address_code.sol index cf2d203e0..470bf3092 100644 --- a/test/libsolidity/semanticTests/various/address_code.sol +++ b/test/libsolidity/semanticTests/various/address_code.sol @@ -14,7 +14,7 @@ contract C { } // ---- // constructor() -> -// gas irOptimized: 166662 +// gas irOptimized: 166659 // gas legacy: 241796 // gas legacyOptimized: 153454 // initCode() -> 0x20, 0 diff --git a/test/libsolidity/semanticTests/various/destructuring_assignment.sol b/test/libsolidity/semanticTests/various/destructuring_assignment.sol index e288ce5e9..01a09e86b 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: 242337 +// gas irOptimized: 242334 // gas legacy: 243284 // gas legacyOptimized: 242420 diff --git a/test/libsolidity/semanticTests/various/value_complex.sol b/test/libsolidity/semanticTests/various/value_complex.sol index 9f262fbde..39b808c34 100644 --- a/test/libsolidity/semanticTests/various/value_complex.sol +++ b/test/libsolidity/semanticTests/various/value_complex.sol @@ -19,7 +19,7 @@ contract test { } // ---- // constructor(), 20 wei -> -// gas irOptimized: 172407 +// gas irOptimized: 172839 // gas legacy: 252296 // gas legacyOptimized: 180352 // sendAmount(uint256): 5 -> 8 diff --git a/test/libsolidity/semanticTests/various/value_insane.sol b/test/libsolidity/semanticTests/various/value_insane.sol index 1e591050c..d3c15bc70 100644 --- a/test/libsolidity/semanticTests/various/value_insane.sol +++ b/test/libsolidity/semanticTests/various/value_insane.sol @@ -18,7 +18,7 @@ contract test { } // ---- // constructor(), 20 wei -> -// gas irOptimized: 173271 +// gas irOptimized: 173703 // gas legacy: 253820 // gas legacyOptimized: 180784 // sendAmount(uint256): 5 -> 8 diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_2.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_2.yul index 6e39f2a1d..48724fd22 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_2.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_2.yul @@ -26,25 +26,25 @@ // { // { // let x := calldataload(0) -// let _2 := 0xf -// let _5 := and(shr(248, x), 0) -// let _10 := 0xff -// let a := and(_5, 255) -// let _14 := and(shr(4, x), 3855) -// let _15 := 12 -// let b := shl(_15, _14) -// let _19 := and(shr(4, x), 3855) -// let c := shl(_15, _19) -// let d := shl(_15, and(shr(255, x), 0)) -// let e := shl(_10, _19) +// let _1 := 0xf +// let _4 := and(shr(248, x), 0) +// let _9 := 0xff +// let a := and(_4, 255) +// let _13 := and(shr(4, x), 3855) +// let _14 := 12 +// let b := shl(_14, _13) +// let _18 := and(shr(4, x), 3855) +// let c := shl(_14, _18) +// let d := shl(_14, and(shr(255, x), 0)) +// let e := shl(_9, _18) // let f := 0 // let g := 0 // sstore(10, a) // sstore(11, b) -// sstore(_15, c) +// sstore(_14, c) // sstore(13, d) // sstore(14, e) -// sstore(_2, f) +// sstore(_1, f) // sstore(16, g) // } // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_3.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_3.yul index 9df15b4e9..f99035937 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_3.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/combine_shift_and_and_3.yul @@ -27,8 +27,8 @@ // let b := and(shr(8, x), 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0) // let c := and(shr(8, x), 0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) // let d := and(shl(8, x), 0x0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00) -// let _14 := 150 -// let e := shl(_14, and(shl(148, x), 0x3ffffffffffffffffffffffffff0000000000000000000000000000000000000)) +// let _13 := 150 +// let e := shl(_13, and(shl(148, x), 0x3ffffffffffffffffffffffffff0000000000000000000000000000000000000)) // sstore(15, x) // sstore(16, a) // sstore(17, b) diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/create2_and_mask.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/create2_and_mask.yul index 086eb1c21..49e2bb602 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/create2_and_mask.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/create2_and_mask.yul @@ -14,9 +14,8 @@ // { // { // let _1 := 0xffffffffffffffffffffffffffffffffffffffff -// let _2 := 0 -// let _3 := 0x20 -// let a := and(create2(0, 0, _3, _2), _1) -// sstore(a, and(_1, create2(0, 0, _3, 0))) +// let _2 := 0x20 +// let a := and(create2(0, 0, _2, 0), _1) +// sstore(a, and(_1, create2(0, 0, _2, 0))) // } // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/create_and_mask.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/create_and_mask.yul index 24ac42eee..1a054fcef 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/create_and_mask.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/create_and_mask.yul @@ -16,8 +16,8 @@ // { // let _1 := 0x20 // let c := create(0, 0, _1) -// let _4 := 0xffffffffffffffffffffffffffffffffffffffff -// let a := and(c, _4) -// sstore(a, and(_4, create(0, 0, _1))) +// let _2 := 0xffffffffffffffffffffffffffffffffffffffff +// let a := and(c, _2) +// sstore(a, and(_2, create(0, 0, _1))) // } // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/exp_simplifications.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/exp_simplifications.yul index 0e98c3d5a..701300729 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/exp_simplifications.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/exp_simplifications.yul @@ -17,8 +17,8 @@ // let t := calldataload(0) // sstore(0, iszero(t)) // sstore(1, 1) -// let _8 := 2 -// sstore(_8, shl(t, 1)) +// let _5 := 2 +// sstore(_5, shl(t, 1)) // sstore(3, exp(8, t)) // sstore(4, sub(iszero(and(t, 1)), and(t, 1))) // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul index b506d206e..d045a0982 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul @@ -7,8 +7,4 @@ // ---- // step: expressionSimplifier // -// { -// { -// sstore(0, sub(calldataload(0), calldataload(0))) -// } -// } +// { { sstore(0, 0) } } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/remove_redundant_shift_masking.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/remove_redundant_shift_masking.yul index d3adb749c..97ae7261b 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/remove_redundant_shift_masking.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/remove_redundant_shift_masking.yul @@ -13,12 +13,12 @@ // // { // { -// let _2 := calldataload(0) -// let _5 := 0xff -// let a := shr(248, _2) -// let b := shr(248, calldataload(0)) -// let c := and(shr(249, calldataload(0)), 0xfa) -// let d := and(shr(247, calldataload(0)), _5) +// let _1 := calldataload(0) +// let _4 := 0xff +// let a := shr(248, _1) +// let b := shr(248, _1) +// let c := and(shr(249, _1), 0xfa) +// let d := and(shr(247, _1), _4) // sstore(a, b) // sstore(c, d) // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/replace_too_large_shift.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/replace_too_large_shift.yul index 85c86f0e4..1b1525677 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/replace_too_large_shift.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/replace_too_large_shift.yul @@ -15,10 +15,10 @@ // { // let a := 0 // let b := 0 -// let _8 := calldataload(2) -// let _9 := 255 -// let c := shl(_9, _8) -// let d := shr(_9, calldataload(3)) +// let _7 := calldataload(2) +// let _8 := 255 +// let c := shl(_8, _7) +// let d := shr(_8, calldataload(3)) // sstore(a, b) // sstore(c, d) // } diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/zero_length_read.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/zero_length_read.yul index 77b7bd5a4..bce2ba232 100644 --- a/test/libyul/yulOptimizerTests/expressionSimplifier/zero_length_read.yul +++ b/test/libyul/yulOptimizerTests/expressionSimplifier/zero_length_read.yul @@ -13,9 +13,8 @@ // { // { // revert(0, 0) -// let _4 := 0 // pop(call(0, 0, 0, 0, 0, 0, 0)) -// revert(0, _4) +// revert(0, 0) // calldatacopy(0, calldataload(2), 0) // return(0, 0) // codecopy(0, calldataload(5), 0) diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul b/test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul index d56a5285e..b5f452865 100644 --- a/test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul +++ b/test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul @@ -11,29 +11,28 @@ // step: expressionSplitter // // { -// let _1 := 0 -// let x := calldataload(_1) -// let _2 := 3 -// let _3 := 2 -// let _4 := add(x, _3) -// let _5 := mul(_4, _2) -// if _5 +// let x := calldataload(0) +// let _1 := 3 +// let _2 := 2 +// let _3 := add(x, _2) +// let _4 := mul(_3, _1) +// if _4 // { // for { let a := 2 } // lt(a, mload(a)) // { -// let _6 := 2 -// let _7 := mul(a, _6) -// a := add(a, _7) +// let _5 := 2 +// let _6 := mul(a, _5) +// a := add(a, _6) // } // { -// let _8 := 4 -// let _9 := 2 -// let _10 := add(a, _9) -// let b := mul(_10, _8) -// let _11 := 2 -// let _12 := mul(b, _11) -// sstore(b, _12) +// let _7 := 4 +// let _8 := 2 +// let _9 := add(a, _8) +// let b := mul(_9, _7) +// let _10 := 2 +// let _11 := mul(b, _10) +// sstore(b, _11) // } // } // } diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul b/test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul index 294cac14a..5c1825693 100644 --- a/test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul +++ b/test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul @@ -12,19 +12,18 @@ // let _1 := 3 // let _2 := 7 // let _3 := mload(_2) -// let _4 := 0 -// let _5 := f(_4, _3) -// let x := mul(_5, _1) +// let _4 := f(0, _3) +// let x := mul(_4, _1) // function f(a, b) -> c // { -// let _6 := add(b, c) -// let _7 := mload(_6) -// c := mul(a, _7) +// let _5 := add(b, c) +// let _6 := mload(_5) +// c := mul(a, _6) // } -// let _8 := 2 -// let _9 := mload(_8) -// let _10 := 2 -// let _11 := mload(_10) -// let _12 := f(_11, _9) -// sstore(x, _12) +// let _7 := 2 +// let _8 := mload(_7) +// let _9 := 2 +// let _10 := mload(_9) +// let _11 := f(_10, _8) +// sstore(x, _11) // } diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/object_access.yul b/test/libyul/yulOptimizerTests/expressionSplitter/object_access.yul index bcd6d0f7b..e44282614 100644 --- a/test/libyul/yulOptimizerTests/expressionSplitter/object_access.yul +++ b/test/libyul/yulOptimizerTests/expressionSplitter/object_access.yul @@ -20,9 +20,8 @@ object "main" { // let _2 := mload(_1) // let _3 := 1 // let _4 := mload(_3) -// let _5 := 0 -// let _6 := mload(_5) -// datacopy(_6, _4, _2) +// let _5 := mload(0) +// datacopy(_5, _4, _2) // } // data "abc" hex"48656c6c6f2c20576f726c6421" // } diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/switch.yul b/test/libyul/yulOptimizerTests/expressionSplitter/switch.yul index 3664a7e26..eaab6ff12 100644 --- a/test/libyul/yulOptimizerTests/expressionSplitter/switch.yul +++ b/test/libyul/yulOptimizerTests/expressionSplitter/switch.yul @@ -10,25 +10,22 @@ // // { // let x := 8 -// let _1 := 0 -// let _2 := calldataload(_1) -// let _3 := 2 -// let _4 := add(_3, _2) -// switch _4 +// let _1 := calldataload(0) +// let _2 := 2 +// let _3 := add(_2, _1) +// switch _3 // case 0 { -// let _5 := 2 -// let _6 := mload(_5) -// let _7 := 0 -// sstore(_7, _6) +// let _4 := 2 +// let _5 := mload(_4) +// sstore(0, _5) // } // default { -// let _8 := 3 -// let _9 := mload(_8) -// let _10 := 0 -// mstore(_10, _9) +// let _6 := 3 +// let _7 := mload(_6) +// mstore(0, _7) // } -// let _11 := 4 -// let _12 := 3 -// let _13 := mload(_12) -// x := add(_13, _11) +// let _8 := 4 +// let _9 := 3 +// let _10 := mload(_9) +// x := add(_10, _8) // } diff --git a/test/libyul/yulOptimizerTests/fullInliner/double_inline.yul b/test/libyul/yulOptimizerTests/fullInliner/double_inline.yul index 259e4aeda..d93f9298a 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/double_inline.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/double_inline.yul @@ -9,19 +9,19 @@ // // { // { -// let a_2 := calldataload(0) -// let b_3 := 0 -// let c_4 := 0 -// b_3 := sload(mload(a_2)) -// c_4 := 3 -// let b3 := b_3 -// let a_6 := c_4 -// let b_7 := 0 -// let c_8 := 0 -// b_7 := sload(mload(a_6)) -// c_8 := 3 -// let b4 := b_7 -// let c4 := c_8 +// let a_1 := calldataload(0) +// let b_2 := 0 +// let c_3 := 0 +// b_2 := sload(mload(a_1)) +// c_3 := 3 +// let b3 := b_2 +// let a_5 := c_3 +// let b_6 := 0 +// let c_7 := 0 +// b_6 := sload(mload(a_5)) +// c_7 := 3 +// let b4 := b_6 +// let c4 := c_7 // } // function f(a) -> b, c // { diff --git a/test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul b/test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul index 39c3bb295..714d18f6a 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul @@ -13,12 +13,12 @@ // // { // { -// let _2 := mload(0) -// let a_10 := mload(1) -// let r_11 := 0 -// a_10 := mload(a_10) -// r_11 := add(a_10, calldatasize()) -// if gt(r_11, _2) { sstore(0, 2) } +// let _1 := mload(0) +// let a_8 := mload(1) +// let r_9 := 0 +// a_8 := mload(a_8) +// r_9 := add(a_8, calldatasize()) +// if gt(r_9, _1) { sstore(0, 2) } // } // function f(a) -> r // { diff --git a/test/libyul/yulOptimizerTests/fullInliner/long_names.yul b/test/libyul/yulOptimizerTests/fullInliner/long_names.yul index b2162c520..1bd3b92ae 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/long_names.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/long_names.yul @@ -13,10 +13,10 @@ // { // { // let verylongvariablename2_1 := 3 -// let verylongvariablename_4 := verylongvariablename2_1 -// let verylongvariablename2_5 := 0 -// verylongvariablename2_5 := add(verylongvariablename_4, verylongvariablename_4) -// mstore(0, verylongvariablename2_5) +// let verylongvariablename_3 := verylongvariablename2_1 +// let verylongvariablename2_4 := 0 +// verylongvariablename2_4 := add(verylongvariablename_3, verylongvariablename_3) +// mstore(0, verylongvariablename2_4) // mstore(1, verylongvariablename2_1) // } // function verylongfunctionname(verylongvariablename) -> verylongvariablename2 diff --git a/test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul b/test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul index 14e977dd3..b9dad45e2 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/multi_fun_callback.yul @@ -30,10 +30,10 @@ // function f(x) // { // mstore(0, x) -// let t_8 := 0 -// t_8 := 2 -// mstore(7, t_8) -// let x_1_9 := 10 +// let t_7 := 0 +// t_7 := 2 +// mstore(7, t_7) +// let x_1_8 := 10 // f(1) // mstore(1, x) // } diff --git a/test/libyul/yulOptimizerTests/fullInliner/multi_return.yul b/test/libyul/yulOptimizerTests/fullInliner/multi_return.yul index 21369f10b..a5fe5a703 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/multi_return.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/multi_return.yul @@ -11,13 +11,13 @@ // // { // { -// let a_3 := mload(0) -// let x_4 := 0 -// let y_5 := 0 -// x_4 := mul(a_3, a_3) -// y_5 := add(a_3, x_4) -// let r := x_4 -// mstore(r, y_5) +// let a_2 := mload(0) +// let x_3 := 0 +// let y_4 := 0 +// x_3 := mul(a_2, a_2) +// y_4 := add(a_2, x_3) +// let r := x_3 +// mstore(r, y_4) // } // function f(a) -> x, y // { diff --git a/test/libyul/yulOptimizerTests/fullInliner/no_inline_leave.yul b/test/libyul/yulOptimizerTests/fullInliner/no_inline_leave.yul index a22025c4b..58431428c 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/no_inline_leave.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/no_inline_leave.yul @@ -9,8 +9,8 @@ // // { // { -// let a_2 := calldataload(0) -// a_2 := g() +// let a_1 := calldataload(0) +// a_1 := g() // } // function g() -> x // { diff --git a/test/libyul/yulOptimizerTests/fullInliner/no_return.yul b/test/libyul/yulOptimizerTests/fullInliner/no_return.yul index 2897b5151..3781b260d 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/no_return.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/no_return.yul @@ -4,13 +4,15 @@ } f(mload(0)) } +// ==== +// EVMVersion: >=shanghai // ---- // step: fullInliner // // { // { -// let a_3 := mload(0) -// sstore(a_3, a_3) +// let a_2 := mload(0) +// sstore(a_2, a_2) // } // function f(a) // { sstore(a, a) } diff --git a/test/libyul/yulOptimizerTests/fullInliner/not_inside_for.yul b/test/libyul/yulOptimizerTests/fullInliner/not_inside_for.yul index 5678a13fd..87c9973df 100644 --- a/test/libyul/yulOptimizerTests/fullInliner/not_inside_for.yul +++ b/test/libyul/yulOptimizerTests/fullInliner/not_inside_for.yul @@ -9,31 +9,33 @@ r := a } } +// ==== +// EVMVersion: >=shanghai // ---- // step: fullInliner // // { // { -// let a_3 := 0 -// let r_4 := 0 -// sstore(a_3, 0) -// r_4 := a_3 -// let x := r_4 +// let a_1 := 0 +// let r_2 := 0 +// sstore(a_1, 0) +// r_2 := a_1 +// let x := r_2 // for { } // f(x) // { -// let a_6 := x -// let r_7 := 0 -// sstore(a_6, 0) -// r_7 := a_6 -// x := r_7 +// let a_3 := x +// let r_4 := 0 +// sstore(a_3, 0) +// r_4 := a_3 +// x := r_4 // } // { -// let a_9 := x -// let r_10 := 0 -// sstore(a_9, 0) -// r_10 := a_9 -// let t := r_10 +// let a_5 := x +// let r_6 := 0 +// sstore(a_5, 0) +// r_6 := a_5 +// let t := r_6 // } // } // function f(a) -> r diff --git a/test/libyul/yulOptimizerTests/fullSimplify/identity_rules_complex.yul b/test/libyul/yulOptimizerTests/fullSimplify/identity_rules_complex.yul index 3e1e4a158..1966f780b 100644 --- a/test/libyul/yulOptimizerTests/fullSimplify/identity_rules_complex.yul +++ b/test/libyul/yulOptimizerTests/fullSimplify/identity_rules_complex.yul @@ -7,8 +7,4 @@ // ---- // step: fullSimplify // -// { -// { -// mstore(sub(calldataload(0), calldataload(0)), 0) -// } -// } +// { { mstore(0, 0) } } diff --git a/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul b/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul index 8a453e004..22ae5598f 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul @@ -506,7 +506,7 @@ // for { } lt(i, length) { i := add(i, 1) } // { // if iszero(slt(add(src, _1), end)) { revert(0, 0) } -// let dst_1 := allocateMemory_967() +// let dst_1 := allocateMemory_902() // let dst_2 := dst_1 // let src_1 := src // let _3 := add(src, 64) @@ -553,7 +553,7 @@ // 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 +// function allocateMemory_902() -> memPtr // { // memPtr := mload(64) // let newFreePtr := add(memPtr, 64) diff --git a/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_mstore.yul b/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_mstore.yul index c62135856..01ebb4ecf 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_mstore.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_mstore.yul @@ -15,9 +15,9 @@ // { // { // let x := calldataload(0) -// let _2 := 0x20 -// sstore(keccak256(_2, x), 2) +// let _1 := 0x20 +// sstore(keccak256(_1, x), 2) // mstore(0, 1) -// sstore(keccak256(_2, x), 3) +// sstore(keccak256(_1, x), 3) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_branch.yul b/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_branch.yul index b780d62b0..63d409043 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_branch.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_branch.yul @@ -26,12 +26,12 @@ // let x := calldataload(0) // let y := calldataload(1) // let a := keccak256(x, y) -// let _3 := 2 -// if calldataload(_3) { a := 8 } -// sstore(keccak256(x, y), _3) +// let _2 := 2 +// if calldataload(_2) { a := 8 } +// sstore(keccak256(x, y), _2) // if calldataload(3) { x := 8 } -// sstore(keccak256(x, y), _3) +// sstore(keccak256(x, y), _2) // if calldataload(4) { y := 8 } -// sstore(keccak256(x, y), _3) +// sstore(keccak256(x, y), _2) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_value.yul b/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_value.yul index 232d76f14..ca23e6407 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_value.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/keccak_reuse_reassigned_value.yul @@ -28,13 +28,13 @@ // let y := calldataload(1) // let a := keccak256(x, y) // sstore(a, 2) -// let _4 := 10 -// a := calldataload(_4) +// let _3 := 10 +// a := calldataload(_3) // sstore(keccak256(x, y), 3) -// x := _4 -// sstore(keccak256(_4, y), 4) +// x := _3 +// sstore(keccak256(_3, y), 4) // y := 9 -// let d := keccak256(_4, y) +// let d := keccak256(_3, y) // sstore(d, 5) // sstore(d, 6) // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/keccak_short.yul b/test/libyul/yulOptimizerTests/loadResolver/keccak_short.yul index baf233050..fd02a0901 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/keccak_short.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/keccak_short.yul @@ -24,12 +24,12 @@ // { // mstore(0, 10) // sstore(0, keccak256(0, 31)) -// let _9 := keccak256(0, 30) -// let _10 := 1 -// sstore(_10, _9) -// let _13 := keccak256(0, _10) -// let _14 := 2 -// sstore(_14, _13) -// sstore(_14, keccak256(0, 0)) +// let _5 := keccak256(0, 30) +// let _6 := 1 +// sstore(_6, _5) +// let _8 := keccak256(0, _6) +// let _9 := 2 +// sstore(_9, _8) +// sstore(_9, keccak256(0, 0)) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/memory_with_different_kinds_of_invalidation.yul b/test/libyul/yulOptimizerTests/loadResolver/memory_with_different_kinds_of_invalidation.yul index 010b6c6b9..24e521c40 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/memory_with_different_kinds_of_invalidation.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/memory_with_different_kinds_of_invalidation.yul @@ -27,11 +27,11 @@ // sstore(0, _1) // pop(call(0, 0, 0, 0, 0, 0, 0)) // sstore(0, mload(_2)) -// let _17 := 10 -// mstore(_2, _17) +// let _8 := 10 +// mstore(_2, _8) // mstore8(calldataload(0), 4) // sstore(0, mload(_2)) -// mstore(_2, _17) -// sstore(0, _17) +// mstore(_2, _8) +// sstore(0, _8) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/memory_with_msize.yul b/test/libyul/yulOptimizerTests/loadResolver/memory_with_msize.yul index 14e91d197..1195758d1 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/memory_with_msize.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/memory_with_msize.yul @@ -12,8 +12,10 @@ // // { // { -// mstore(calldataload(0), msize()) +// let _1 := msize() +// let _2 := calldataload(0) +// mstore(_2, _1) // let t := mload(calldataload(10)) -// sstore(t, mload(calldataload(0))) +// sstore(t, mload(_2)) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/merge_known_write.yul b/test/libyul/yulOptimizerTests/loadResolver/merge_known_write.yul index 573cb8b01..4e493714d 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/merge_known_write.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/merge_known_write.yul @@ -14,10 +14,12 @@ // // { // { -// mstore(calldataload(0), calldataload(10)) -// let _5 := 1 -// if calldataload(_5) { mstore(calldataload(0), _5) } +// let _2 := calldataload(10) +// let _3 := calldataload(0) +// mstore(_3, _2) +// let _4 := 1 +// if calldataload(_4) { mstore(_3, _4) } // let t := mload(0) -// sstore(t, mload(calldataload(0))) +// sstore(t, mload(_3)) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/merge_known_write_with_distance.yul b/test/libyul/yulOptimizerTests/loadResolver/merge_known_write_with_distance.yul index e9805aeea..84b0cc48a 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/merge_known_write_with_distance.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/merge_known_write_with_distance.yul @@ -14,13 +14,11 @@ // // { // { -// mstore(calldataload(0), calldataload(10)) -// let _5 := 1 -// if calldataload(_5) -// { -// mstore(add(calldataload(0), 0x20), _5) -// } -// let t := mload(add(calldataload(0), 0x20)) -// sstore(t, mload(calldataload(0))) +// let _2 := calldataload(10) +// let _3 := calldataload(0) +// mstore(_3, _2) +// let _4 := 1 +// if calldataload(_4) { mstore(add(_3, 0x20), _4) } +// sstore(mload(add(_3, 0x20)), _2) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul index 599937aa7..944c4924a 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/merge_mload_with_known_distance.yul @@ -14,12 +14,10 @@ // // { // { -// let _3 := 1 -// if calldataload(_3) -// { -// mstore(add(calldataload(0), 0x20), _3) -// } -// let t := mload(add(calldataload(0), 0x20)) -// sstore(t, mload(calldataload(0))) +// let _1 := calldataload(0) +// let x := mload(_1) +// let _2 := 1 +// if calldataload(_2) { mstore(add(_1, 0x20), _2) } +// sstore(mload(add(_1, 0x20)), x) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/merge_unknown_write.yul b/test/libyul/yulOptimizerTests/loadResolver/merge_unknown_write.yul index 38930a93e..4adbdd97a 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/merge_unknown_write.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/merge_unknown_write.yul @@ -14,10 +14,12 @@ // // { // { -// mstore(calldataload(0), calldataload(10)) -// let _5 := 1 -// if calldataload(_5) { mstore(0, _5) } +// let _2 := calldataload(10) +// let _3 := calldataload(0) +// mstore(_3, _2) +// let _4 := 1 +// if calldataload(_4) { mstore(0, _4) } // let t := mload(0) -// sstore(t, mload(calldataload(0))) +// sstore(t, mload(_3)) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/simple.yul b/test/libyul/yulOptimizerTests/loadResolver/simple.yul index 0229223d2..f7389f8d9 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/simple.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/simple.yul @@ -13,7 +13,6 @@ // { // let _2 := calldataload(10) // sstore(calldataload(0), _2) -// let t := sload(_2) -// mstore(t, sload(calldataload(0))) +// mstore(sload(_2), _2) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/simple_memory.yul b/test/libyul/yulOptimizerTests/loadResolver/simple_memory.yul index 164f0f8b5..3ad6a5062 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/simple_memory.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/simple_memory.yul @@ -13,7 +13,6 @@ // { // let _2 := calldataload(10) // mstore(calldataload(0), _2) -// let t := mload(_2) -// sstore(t, mload(calldataload(0))) +// sstore(mload(_2), _2) // } // } diff --git a/test/libyul/yulOptimizerTests/loadResolver/zero_length_reads.yul b/test/libyul/yulOptimizerTests/loadResolver/zero_length_reads.yul index afa8fcdd4..b6c8c665e 100644 --- a/test/libyul/yulOptimizerTests/loadResolver/zero_length_reads.yul +++ b/test/libyul/yulOptimizerTests/loadResolver/zero_length_reads.yul @@ -23,23 +23,22 @@ // // { // { -// let _1 := 0 -// let _2 := 1 -// returndatacopy(0, _2, _1) -// calldatacopy(0, _2, 0) -// extcodecopy(_2, 0, _2, 0) -// codecopy(0, _2, 0) +// let _1 := 1 +// returndatacopy(0, _1, 0) +// calldatacopy(0, _1, 0) +// extcodecopy(_1, 0, _1, 0) +// codecopy(0, _1, 0) // log0(0, 0) -// log1(0, 0, _2) -// log2(0, 0, _2, _2) -// log3(0, 0, _2, _2, _2) -// log4(0, 0, _2, _2, _2, _2) -// pop(create(_2, 0, 0)) -// pop(create2(_2, 0, 0, _2)) -// pop(call(_2, _2, _2, 0, 0, _2, 0)) -// pop(callcode(_2, _2, _2, 0, 0, _2, 0)) -// pop(delegatecall(_2, _2, 0, 0, _2, 0)) -// pop(staticcall(_2, _2, 0, 0, _2, 0)) +// log1(0, 0, _1) +// log2(0, 0, _1, _1) +// log3(0, 0, _1, _1, _1) +// log4(0, 0, _1, _1, _1, _1) +// pop(create(_1, 0, 0)) +// pop(create2(_1, 0, 0, _1)) +// pop(call(_1, _1, _1, 0, 0, _1, 0)) +// pop(callcode(_1, _1, _1, 0, 0, _1, 0)) +// pop(delegatecall(_1, _1, 0, 0, _1, 0)) +// pop(staticcall(_1, _1, 0, 0, _1, 0)) // return(0, 0) // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy.yul index 7fd227089..8cf222892 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy.yul @@ -30,28 +30,27 @@ // let start := calldataload(0x10) // if calldataload(0) // { -// let _4 := 7 -// mstore(add(start, 2), _4) +// let _3 := 7 +// mstore(add(start, 2), _3) // calldatacopy(start, 0, 0x20) // } // if calldataload(1) // { -// let _11 := 9 -// mstore(add(start, 2), _11) -// let _14 := 0x21 -// let _15 := 0 -// calldatacopy(add(start, 1), _15, _14) +// let _9 := 9 +// mstore(add(start, 2), _9) +// let _12 := 0x21 +// calldatacopy(add(start, 1), 0, _12) // } // if calldataload(2) // { -// let _20 := 7 -// mstore8(add(start, 2), _20) +// let _17 := 7 +// mstore8(add(start, 2), _17) // calldatacopy(start, 0, 3) // } // if calldataload(3) // { -// let _27 := 7 -// mstore8(add(start, 3), _27) +// let _23 := 7 +// mstore8(add(start, 3), _23) // calldatacopy(start, 0, 3) // } // sstore(0, keccak256(start, 0x40)) diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy_fixed.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy_fixed.yul index 47e0b95fa..da5432435 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy_fixed.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/covering_calldatacopy_fixed.yul @@ -33,14 +33,13 @@ // } // if calldataload(1) // { -// let _10 := 9 -// let _11 := 2 +// let _7 := 9 +// let _8 := 2 // calldatacopy(1, 0, 0x21) // } // if calldataload(2) // { -// let _17 := 7 -// let _18 := 2 +// mstore8(2, 7) // calldatacopy(0, 0, 3) // } // if calldataload(3) diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/if_overwrite_all_branches.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/if_overwrite_all_branches.yul index 7054dc255..b15fecd84 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/if_overwrite_all_branches.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/if_overwrite_all_branches.yul @@ -13,8 +13,8 @@ // { // { // let c := calldataload(0) -// let _2 := 1 -// if c { let _3 := 2 } +// let _1 := 1 +// if c { let _2 := 2 } // sstore(c, 3) // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/leave.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/leave.yul index 92a751554..302cef737 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/leave.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/leave.yul @@ -16,8 +16,7 @@ // { // mstore(0, 5) // if calldataload(0) { leave } -// let _5 := 5 -// let _6 := 0x20 +// mstore(0x20, 5) // revert(0, 0) // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/no_storage_inside_function.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/no_storage_inside_function.yul index 524b328e9..4a81e3ae2 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/no_storage_inside_function.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/no_storage_inside_function.yul @@ -22,6 +22,6 @@ // function f() -> r // { // r := mload(0x20) -// let r_7 := r +// let r_6 := r // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/remove_before_revert.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/remove_before_revert.yul index e7777964c..3d23316f9 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/remove_before_revert.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/remove_before_revert.yul @@ -13,8 +13,8 @@ // { // { // let c := calldataload(0) -// let _2 := 4 -// if c { let _3 := 2 } +// let _1 := 4 +// if c { let _2 := 2 } // let d := 0 // revert(d, d) // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize.yul index e0d5cbf1c..b495ed324 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize.yul @@ -8,8 +8,6 @@ // // { // { -// let _1 := returndatasize() -// let _2 := 0 -// let _3 := 0 +// returndatacopy(0, 0, returndatasize()) // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize_var.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize_var.yul index eac2070f7..5f9dc9c06 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize_var.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/returndatacopy_returndatasize_var.yul @@ -9,8 +9,6 @@ // // { // { -// let s := returndatasize() -// let _1 := 0 -// let _2 := 0 +// returndatacopy(0, 0, returndatasize()) // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/unknown_length2.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/unknown_length2.yul index db5f060a6..1199e5f3c 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/unknown_length2.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/unknown_length2.yul @@ -13,21 +13,19 @@ // // { // { -// let a_9 -// let a := a_9 +// let a_5 +// let a := a_5 // switch calldataload(0) // case 0 { // a := calldataload(9) -// let a_10 := a +// let a_6 := a // } // case 1 { -// let a_12 := a +// let a_8 := a // a := calldataload(10) -// let a_11 := a +// let a_7 := a // } -// let a_13 := a -// let _5 := 0 -// let _6 := 0x20 +// calldatacopy(0x20, 0, a) // sstore(0, mload(0)) // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/unrelated_relative.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/unrelated_relative.yul index b0b42060f..15a4e2fdd 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/unrelated_relative.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/unrelated_relative.yul @@ -13,11 +13,11 @@ // { // let c := calldataload(0) // mstore(c, 4) -// let _3 := 8 -// let _5 := add(c, 0x20) +// let _2 := 8 +// let _4 := add(c, 0x20) // sstore(0, mload(c)) -// let _8 := 9 -// let _9 := 20 -// let _11 := add(c, 0x20) +// let _6 := 9 +// let _7 := 20 +// let _9 := add(c, 0x20) // } // } diff --git a/test/libyul/yulOptimizerTests/unusedStoreEliminator/write_before_recursion.yul b/test/libyul/yulOptimizerTests/unusedStoreEliminator/write_before_recursion.yul index 855ae8325..e917022d2 100644 --- a/test/libyul/yulOptimizerTests/unusedStoreEliminator/write_before_recursion.yul +++ b/test/libyul/yulOptimizerTests/unusedStoreEliminator/write_before_recursion.yul @@ -15,9 +15,7 @@ // { // { // let _1 := 1 -// let _2 := 0 -// let _3 := 2 -// let _4 := 0 +// let _2 := 2 // f() // } // function f()