solidity/test/libyul/yulOptimizerTests/ssaTransform/switch.yul

30 lines
603 B
Plaintext
Raw Normal View History

2018-10-16 21:47:02 +00:00
{
let a := mload(0)
// This could be more efficient:
// all cases could use the value of the variable from just before
// the switch and not just the first
switch a
case 0 { a := add(a, 4) }
default { a := add(a, 8) }
mstore(0, a)
}
2019-04-01 14:33:46 +00:00
// ====
// step: ssaTransform
2018-10-16 21:47:02 +00:00
// ----
// {
// let a_1 := mload(0)
// let a := a_1
// switch a_1
// case 0 {
// let a_2 := add(a_1, 4)
// a := a_2
// }
// default {
// let a_4 := a
// let a_3 := add(a_4, 8)
2018-10-16 21:47:02 +00:00
// a := a_3
// }
// let a_5 := a
// mstore(0, a_5)
2018-10-16 21:47:02 +00:00
// }