aboutsummaryrefslogtreecommitdiffstats
path: root/test/libjulia
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-12 01:58:09 +0800
committerchriseth <chris@ethereum.org>2018-10-12 23:11:13 +0800
commit7940dafd0d176dd029ef6f6ac7ad6aa60e32e8c0 (patch)
tree4ef3d29839f1127a26ff3b20d580e4c63069f9c9 /test/libjulia
parent26dc876c28718613ad64961e65374ace1139010b (diff)
downloaddexon-solidity-7940dafd0d176dd029ef6f6ac7ad6aa60e32e8c0.tar.gz
dexon-solidity-7940dafd0d176dd029ef6f6ac7ad6aa60e32e8c0.tar.zst
dexon-solidity-7940dafd0d176dd029ef6f6ac7ad6aa60e32e8c0.zip
Also substitute variables in CSE.
Diffstat (limited to 'test/libjulia')
-rw-r--r--test/libjulia/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/libjulia/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul b/test/libjulia/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul
new file mode 100644
index 00000000..ab94afc2
--- /dev/null
+++ b/test/libjulia/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul
@@ -0,0 +1,27 @@
+{
+
+ let a := mload(0)
+ let b := add(a, 7)
+ let c := a
+ let d := c
+ let x := add(a, b)
+ // CSE has to recognize equality with x here.
+ let y := add(d, add(c, 7))
+ // some reassignments
+ b := mload(a)
+ a := b
+ mstore(2, a)
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let a := mload(0)
+// let b := add(a, 7)
+// let c := a
+// let d := a
+// let x := add(a, b)
+// let y := x
+// b := mload(a)
+// a := b
+// mstore(2, b)
+// }