solidity/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/object_access.yul

25 lines
624 B
Plaintext
Raw Normal View History

2018-12-20 16:39:52 +00:00
{
// 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)
}
2019-04-01 14:33:46 +00:00
// ====
// step: commonSubexpressionEliminator
2018-12-20 16:39:52 +00:00
// ----
// {
// let r := "abc"
// let a := datasize("abc")
// let x := dataoffset("abc")
// let y := a
// datacopy(r, x, a)
// mstore(a, x)
// }