aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-12-04 21:10:22 +0800
committerGitHub <noreply@github.com>2018-12-04 21:10:22 +0800
commit4e5dabf832ddefc30035e67ad450a12f17c8345a (patch)
tree7ac0b31a18d1566976e751a6c1f9354013d90db4 /test
parente49f37be7f64d0306c2e63cea81eb98aa1bc85f1 (diff)
parent1b8a013d4a24f9f92b7c205a0ac2d9c8c049ee7f (diff)
downloaddexon-solidity-4e5dabf832ddefc30035e67ad450a12f17c8345a.tar.gz
dexon-solidity-4e5dabf832ddefc30035e67ad450a12f17c8345a.tar.zst
dexon-solidity-4e5dabf832ddefc30035e67ad450a12f17c8345a.zip
Merge pull request #5585 from ethereum/forInitRewriteNested
[Yul] Proper recursion in ForLoopInitRewriter.
Diffstat (limited to 'test')
-rw-r--r--test/libyul/yulOptimizerTests/forLoopInitRewriter/nested.yul48
-rw-r--r--test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul10
2 files changed, 53 insertions, 5 deletions
diff --git a/test/libyul/yulOptimizerTests/forLoopInitRewriter/nested.yul b/test/libyul/yulOptimizerTests/forLoopInitRewriter/nested.yul
new file mode 100644
index 00000000..3f7aa089
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/forLoopInitRewriter/nested.yul
@@ -0,0 +1,48 @@
+{
+ let random := 42
+ for {
+ for { let a := 1} iszero(eq(a,10)) {} {
+ a := add(a, 1)
+ }
+ let b := 1
+ } iszero(eq(b, 10)) {
+ for { let c := 1 } iszero(eq(c,2)) { c := add(c, 1) } {
+ b := add(b, 1)
+ }
+ } {
+ mstore(b,b)
+ }
+}
+// ----
+// forLoopInitRewriter
+// {
+// let random := 42
+// let a := 1
+// for {
+// }
+// iszero(eq(a, 10))
+// {
+// }
+// {
+// a := add(a, 1)
+// }
+// let b := 1
+// for {
+// }
+// iszero(eq(b, 10))
+// {
+// let c := 1
+// for {
+// }
+// iszero(eq(c, 2))
+// {
+// c := add(c, 1)
+// }
+// {
+// b := add(b, 1)
+// }
+// }
+// {
+// mstore(b, b)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul b/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul
index a34da198..573e7868 100644
--- a/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul
+++ b/test/libyul/yulOptimizerTests/fullSuite/abi_example1.yul
@@ -468,8 +468,8 @@
// let abi_encode_pos_590 := 64
// abi_encode_pos := abi_encode_pos_590
// let abi_encode_srcPtr := add(_485, _1)
+// let abi_encode_i_69 := _2
// for {
-// let abi_encode_i_69 := _2
// }
// lt(abi_encode_i_69, abi_encode_length_68)
// {
@@ -480,8 +480,8 @@
// let abi_encode_pos_71_1037 := abi_encode_pos
// let abi_encode_length_72_1038 := 0x3
// let abi_encode_srcPtr_73_1039 := _931
+// let abi_encode_i_74_1040 := _2
// for {
-// let abi_encode_i_74_1040 := _2
// }
// lt(abi_encode_i_74_1040, abi_encode_length_72_1038)
// {
@@ -544,8 +544,8 @@
// {
// revert(_2, _2)
// }
+// let abi_decode_i_33_1052 := _2
// for {
-// let abi_decode_i_33_1052 := _2
// }
// lt(abi_decode_i_33_1052, abi_decode_length_30_1046)
// {
@@ -586,8 +586,8 @@
// {
// revert(_2, _2)
// }
+// let abi_decode_i_9_1068 := _2
// for {
-// let abi_decode_i_9_1068 := _2
// }
// lt(abi_decode_i_9_1068, abi_decode_length_6_1058)
// {
@@ -616,8 +616,8 @@
// {
// revert(_2, _2)
// }
+// let abi_decode_abi_decode_i_17_1073 := _2
// for {
-// let abi_decode_abi_decode_i_17_1073 := _2
// }
// lt(abi_decode_abi_decode_i_17_1073, abi_decode_abi_decode_length_14_1069)
// {