aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-10-19 00:58:46 +0800
committerGitHub <noreply@github.com>2018-10-19 00:58:46 +0800
commit52ffe5262edb3bd1fcb2477d8f3339f135f85563 (patch)
tree2106f5a23016d73cee12dd81a65ae45fa2400786 /test
parent7609e2871e77b623d4c6187b7ebed693ce74cd0e (diff)
parent48749146da6bd335928126855053ea0e3b66aee4 (diff)
downloaddexon-solidity-52ffe5262edb3bd1fcb2477d8f3339f135f85563.tar.gz
dexon-solidity-52ffe5262edb3bd1fcb2477d8f3339f135f85563.tar.zst
dexon-solidity-52ffe5262edb3bd1fcb2477d8f3339f135f85563.zip
Merge pull request #5269 from ethereum/cseBugfix
Bugfix in common subexpression eliminator related to scopes.
Diffstat (limited to 'test')
-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..49b4c916
--- /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, calldataload(0))
+// mstore(0, x)
+// }