aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/object_access.yul
blob: 5cfa3e6e626fb3cbb085b98baf329dbfe2e3e9ea (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
{
    // Arguments to ``datasize`` and ``dataoffset`` need to be
    // literals. We cannot simplify their arguments, but we can
    // simplify them as a full expression.
    // ``datacopy`` does not have this restriction.
    let r := "abc"
    let a := datasize("abc")
    let x := dataoffset("abc")
    // should be replaced by a
    let y := datasize("abc")
    datacopy("abc", x, y)
    mstore(a, x)
}
// ----
// commonSubexpressionEliminator
// {
//     let r := "abc"
//     let a := datasize("abc")
//     let x := dataoffset("abc")
//     let y := a
//     datacopy(r, x, a)
//     mstore(a, x)
// }