aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/yulOptimizerTests/ssaTransform/switch.yul
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-17 05:47:02 +0800
committerchriseth <chris@ethereum.org>2018-10-19 00:56:22 +0800
commit465845b7a7e41345c47722bf7f2fcbd8b48248db (patch)
tree10f936061e8033eb9bfd07761b97a97a05d4f14f /test/libyul/yulOptimizerTests/ssaTransform/switch.yul
parent7609e2871e77b623d4c6187b7ebed693ce74cd0e (diff)
downloaddexon-solidity-465845b7a7e41345c47722bf7f2fcbd8b48248db.tar.gz
dexon-solidity-465845b7a7e41345c47722bf7f2fcbd8b48248db.tar.zst
dexon-solidity-465845b7a7e41345c47722bf7f2fcbd8b48248db.zip
SSA transform - first step.
Diffstat (limited to 'test/libyul/yulOptimizerTests/ssaTransform/switch.yul')
-rw-r--r--test/libyul/yulOptimizerTests/ssaTransform/switch.yul26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/libyul/yulOptimizerTests/ssaTransform/switch.yul b/test/libyul/yulOptimizerTests/ssaTransform/switch.yul
new file mode 100644
index 00000000..bc9b55bb
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/ssaTransform/switch.yul
@@ -0,0 +1,26 @@
+{
+ 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)
+}
+// ----
+// ssaTransform
+// {
+// 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_3 := add(a, 8)
+// a := a_3
+// }
+// mstore(0, a)
+// }