aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/scopes.yul
blob: 35270d878a62594eba2942d3479cc3daab901326 (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
{
    let a := 10
    let x := 20
    {
        let b := calldataload(0)
        let d := calldataload(1)
        x := d
    }
    // We had a bug where "calldataload(0)" was incorrectly replaced by "b"
    mstore(0, calldataload(0))
    mstore(0, x)
}
// ----
// commonSubexpressionEliminator
// {
//     let a := 10
//     let x := 20
//     {
//         let b := calldataload(0)
//         let d := calldataload(1)
//         x := d
//     }
//     mstore(0, b)
//     mstore(0, x)
// }