aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/yulOptimizerTests/ssaPlusCleanup/control_structures.yul
blob: 51d1627f0955997fb950bed473d874920106a17b (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
{
    function copy(from, to) -> length {
        length := mload(from)
        mstore(to, length)
        from := add(from, 0x20)
        to := add(to, 0x20)
        for { let x := 1 } lt(x, length) { x := add(x, 0x20) } {
            mstore(add(to, x), mload(add(from, x)))
        }
    }
}
// ----
// ssaPlusCleanup
// {
//     function copy(from, to) -> length
//     {
//         let length_1 := mload(from)
//         length := length_1
//         mstore(to, length_1)
//         let from_1 := add(from, 0x20)
//         let to_1 := add(to, 0x20)
//         for {
//             let x_1 := 1
//             let x := x_1
//         }
//         lt(x, length_1)
//         {
//             let x_2 := add(x, 0x20)
//             x := x_2
//         }
//         {
//             mstore(add(to_1, x), mload(add(from_1, x)))
//         }
//     }
// }