solidity/test/libyul/yulOptimizerTests/rematerialiser/medium_sized_constant.yul

27 lines
534 B
Plaintext
Raw Normal View History

{
// Constants cost depending on their magnitude.
// Rematerialize small constants only if they are
// not used too often.
// b is used 5 times
let b := 2
mstore(b, b)
mstore(add(b, b), b)
// a is used 7 times
let a := 1
mstore(a, a)
mstore(add(a, a), a)
mstore(a, mload(a))
}
2019-04-01 14:33:46 +00:00
// ====
// step: rematerialiser
// ----
// {
// let b := 2
// mstore(2, 2)
// mstore(add(2, 2), 2)
// let a := 1
// mstore(a, a)
// mstore(add(a, a), a)
// mstore(a, mload(a))
// }