aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-17 03:38:23 +0800
committerchriseth <chris@ethereum.org>2018-10-18 20:54:23 +0800
commitc34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35 (patch)
treeb4e0d1c39c7010103579e2b9cc19b37ed3c55bdd
parent7609e2871e77b623d4c6187b7ebed693ce74cd0e (diff)
downloaddexon-solidity-c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35.tar
dexon-solidity-c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35.tar.gz
dexon-solidity-c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35.tar.bz2
dexon-solidity-c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35.tar.lz
dexon-solidity-c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35.tar.xz
dexon-solidity-c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35.tar.zst
dexon-solidity-c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35.zip
Test case that shows a CSE bug related to scopes.
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/scopes.yul25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/scopes.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/scopes.yul
new file mode 100644
index 00000000..35270d87
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/scopes.yul
@@ -0,0 +1,25 @@
+{
+ let a := 10
+ let x := 20
+ {
+ let b := calldataload(0)
+ let d := calldataload(1)
+ x := d
+ }
+ // We had a bug where "calldataload(0)" was incorrectly replaced by "b"
+ mstore(0, calldataload(0))
+ mstore(0, x)
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let a := 10
+// let x := 20
+// {
+// let b := calldataload(0)
+// let d := calldataload(1)
+// x := d
+// }
+// mstore(0, b)
+// mstore(0, x)
+// }