aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/yulOptimizerTests/fullSuite/ssaReverse.yul
blob: 204b444e5d663b3359aaf567145b54c87f7cd7f6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
    // This is an abi decode function with the SSA transform applied once.
    // This test is supposed to verify that the SSA transform is correctly reversed by the full suite.
    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(0, 0)
        }
        let length_15_1 := calldataload(offset_12)
        length_15 := length_15_1
        if gt(length_15_1, 0xffffffffffffffff)
        {
            revert(0, 0)
        }
        let arrayPos_14_2 := add(offset_12, 0x20)
        arrayPos_14 := arrayPos_14_2
        if gt(add(arrayPos_14_2, mul(length_15_1, 0x1)), end_13)
        {
            revert(0, 0)
        }
    }

    // prevent inlining
    let a,b := abi_decode_t_bytes_calldata_ptr(mload(0),mload(1))
    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)
    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)
}
// ----
// fullSuite
// {
//     let a, b := abi_decode_t_bytes_calldata_ptr(mload(0), mload(1))
//     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)
//     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)
//     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(0, 0)
//         }
//         length_15 := calldataload(offset_12)
//         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)
//         }
//     }
// }