aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/yulOptimizerTests/fullInliner/large_function_multi_use.yul
blob: 3a7ee2f3f23e437c5f3ed800bd7846de4cc8ad26 (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
{
    function f(a) -> b {
        let x := mload(a)
        b := sload(x)
        let y := add(a, x)
        sstore(y, 10)
    }
    let a := mload(2)
    let a2 := 2
    // This should not be inlined because it is not a constant
    let r := f(a)
    // This should be inlined because it is a constant
    let t := f(a2)
    let a3
    // This should be inlined because it is a constant as well (zero)
    let s := f(a3)
}
// ----
// fullInliner
// {
//     {
//         let a_1 := mload(2)
//         let a2 := 2
//         let f_a := a_1
//         let f_b := 0
//         let f_x := mload(f_a)
//         f_b := sload(f_x)
//         let f_y := add(f_a, f_x)
//         sstore(f_y, 10)
//         let r := f_b
//         let f_a_3 := a2
//         let f_b_4 := 0
//         let f_x_5 := mload(f_a_3)
//         f_b_4 := sload(f_x_5)
//         let f_y_6 := add(f_a_3, f_x_5)
//         sstore(f_y_6, 10)
//         let t := f_b_4
//         let a3
//         let f_a_8 := a3
//         let f_b_9 := 0
//         let f_x_10 := mload(f_a_8)
//         f_b_9 := sload(f_x_10)
//         let f_y_11 := add(f_a_8, f_x_10)
//         sstore(f_y_11, 10)
//         let s := f_b_9
//     }
//     function f(a) -> b
//     {
//         let x := mload(a)
//         b := sload(x)
//         let y := add(a, x)
//         sstore(y, 10)
//     }
// }