From c34fa43d5ba9aa2a9b52d3cc06e4150545fd0b35 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Oct 2018 21:38:23 +0200 Subject: Test case that shows a CSE bug related to scopes. --- .../commonSubexpressionEliminator/scopes.yul | 25 ++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 test/libyul/yulOptimizerTests/commonSubexpressionEliminator/scopes.yul 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) +// } -- cgit v1.2.3