aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
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..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)
+// }