From 95dbbdae2294550f0a99dbdac22bc386d89209f1 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 17 Aug 2021 22:50:27 +0200 Subject: [PATCH] Prepare tests to be meaningful. --- test/cmdlineTests/yul_optimize_runs/input.yul | 2 +- test/cmdlineTests/yul_optimize_runs/output | 7 +++---- test/libyul/yulOptimizerTests/fullSuite/medium.yul | 7 ++++++- .../fullSuite/reuse_vars_bug_in_simplifier.yul | 4 ++-- test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul | 4 ++-- .../yulOptimizerTests/fullSuite/ssaReverseComplex.yul | 4 ++-- test/libyul/yulOptimizerTests/fullSuite/switch_inline.yul | 4 ++-- .../fullSuite/switch_inline_match_default.yul | 4 ++-- 8 files changed, 20 insertions(+), 16 deletions(-) diff --git a/test/cmdlineTests/yul_optimize_runs/input.yul b/test/cmdlineTests/yul_optimize_runs/input.yul index aeb7fd282..07c602a4a 100644 --- a/test/cmdlineTests/yul_optimize_runs/input.yul +++ b/test/cmdlineTests/yul_optimize_runs/input.yul @@ -7,7 +7,7 @@ object "RunsTest1" { object "Runtime" { code { let funcSel := shl(224, 0xabc12345) - mstore(0, funcSel) + sstore(0, funcSel) } } } diff --git a/test/cmdlineTests/yul_optimize_runs/output b/test/cmdlineTests/yul_optimize_runs/output index 20196dcb5..4c98ec30e 100644 --- a/test/cmdlineTests/yul_optimize_runs/output +++ b/test/cmdlineTests/yul_optimize_runs/output @@ -13,7 +13,7 @@ object "RunsTest1" { object "Runtime" { code { { - mstore(0, 0xabc1234500000000000000000000000000000000000000000000000000000000) + sstore(0, 0xabc1234500000000000000000000000000000000000000000000000000000000) } } } @@ -21,7 +21,7 @@ object "RunsTest1" { Binary representation: -602480600d600039806000f3fe7fabc1234500000000000000000000000000000000000000000000000000000000600052 +602480600d600039806000f3fe7fabc1234500000000000000000000000000000000000000000000000000000000600055 Text representation: /* "yul_optimize_runs/input.yul":106:125 */ @@ -47,6 +47,5 @@ sub_0: assembly { /* "yul_optimize_runs/input.yul":277:278 */ 0x00 /* "yul_optimize_runs/input.yul":270:288 */ - mstore + sstore } - diff --git a/test/libyul/yulOptimizerTests/fullSuite/medium.yul b/test/libyul/yulOptimizerTests/fullSuite/medium.yul index 4f1a6f35d..41b77c115 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/medium.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/medium.yul @@ -15,6 +15,8 @@ if sub(2,1) { for { switch mul(1,2) case 2 { mstore(0x40, 0x20) } } sub(1,1) {} { mstore(0x80, 0x40) } } + sstore(0, array_index_access(x, 3)) + sstore(1, mload(0x40)) } // ---- // step: fullSuite @@ -24,7 +26,10 @@ // let p := mload(0x40) // mstore(0x40, add(p, 0x20)) // mstore(0x40, add(p, 96)) -// mstore(add(p, 128), 2) +// let p_1 := add(p, 128) +// mstore(p_1, 2) // mstore(0x40, 0x20) +// sstore(0, p_1) +// sstore(1, 0x20) // } // } diff --git a/test/libyul/yulOptimizerTests/fullSuite/reuse_vars_bug_in_simplifier.yul b/test/libyul/yulOptimizerTests/fullSuite/reuse_vars_bug_in_simplifier.yul index 6e217ae4f..93f2f4ad6 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/reuse_vars_bug_in_simplifier.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/reuse_vars_bug_in_simplifier.yul @@ -6,10 +6,10 @@ function foo() -> x_9 { x_9 := sub(1,sub(x_9,1)) - mstore(sub(1,div(sub(x_9,1),sub(1,sub(x_9,1)))), 1) + sstore(sub(1,div(sub(x_9,1),sub(1,sub(x_9,1)))), 1) } } // ---- // step: fullSuite // -// { { mstore(1, 1) } } +// { { sstore(1, 1) } } diff --git a/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul b/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul index 427c9166b..a7ecc0e46 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul @@ -29,7 +29,7 @@ a,b := abi_decode_t_bytes_calldata_ptr(a,b) a,b := abi_decode_t_bytes_calldata_ptr(a,b) a,b := abi_decode_t_bytes_calldata_ptr(a,b) - mstore(a,b) + sstore(a,b) } // ---- // step: fullSuite @@ -43,7 +43,7 @@ // let a_4, b_4 := abi_decode_bytes_calldata(a_3, b_3) // let a_5, b_5 := abi_decode_bytes_calldata(a_4, b_4) // let a_6, b_6 := abi_decode_bytes_calldata(a_5, b_5) -// mstore(a_6, b_6) +// sstore(a_6, b_6) // } // function abi_decode_bytes_calldata(offset, end) -> arrayPos, length // { diff --git a/test/libyul/yulOptimizerTests/fullSuite/ssaReverseComplex.yul b/test/libyul/yulOptimizerTests/fullSuite/ssaReverseComplex.yul index 4421dd3cd..3a061155b 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/ssaReverseComplex.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/ssaReverseComplex.yul @@ -7,7 +7,7 @@ a := mload(b) b := mload(a) } - mstore(a, b) + sstore(a, b) } // ---- // step: fullSuite @@ -21,6 +21,6 @@ // a := mload(mload(mload(b))) // b := mload(a) // } -// mstore(a, b) +// sstore(a, b) // } // } diff --git a/test/libyul/yulOptimizerTests/fullSuite/switch_inline.yul b/test/libyul/yulOptimizerTests/fullSuite/switch_inline.yul index 65c7512d3..1ed995124 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/switch_inline.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/switch_inline.yul @@ -1,5 +1,5 @@ { - mstore(f(1), 0) + sstore(f(1), 0) function f(x) -> y { switch x case 0 { y := 8 } @@ -9,4 +9,4 @@ // ---- // step: fullSuite // -// { { mstore(9, 0) } } +// { { sstore(9, 0) } } diff --git a/test/libyul/yulOptimizerTests/fullSuite/switch_inline_match_default.yul b/test/libyul/yulOptimizerTests/fullSuite/switch_inline_match_default.yul index cff8bd755..6ca3314ab 100644 --- a/test/libyul/yulOptimizerTests/fullSuite/switch_inline_match_default.yul +++ b/test/libyul/yulOptimizerTests/fullSuite/switch_inline_match_default.yul @@ -1,5 +1,5 @@ { - mstore(f(3), 0) + sstore(f(3), 0) function f(x) -> y { switch x case 0 { y := 8 } @@ -10,4 +10,4 @@ // ---- // step: fullSuite // -// { { mstore(10, 0) } } +// { { sstore(10, 0) } }