diff options
Diffstat (limited to 'test/libyul/yulOptimizerTests')
4 files changed, 87 insertions, 0 deletions
diff --git a/test/libyul/yulOptimizerTests/blockFlattener/basic.yul b/test/libyul/yulOptimizerTests/blockFlattener/basic.yul new file mode 100644 index 00000000..adcaedd0 --- /dev/null +++ b/test/libyul/yulOptimizerTests/blockFlattener/basic.yul @@ -0,0 +1,20 @@ +{ + let _1 := mload(0) + let f_a := mload(1) + let f_r + { + f_a := mload(f_a) + f_r := add(f_a, calldatasize()) + } + let z := mload(2) +} +// ---- +// blockFlattener +// { +// let _1 := mload(0) +// let f_a := mload(1) +// let f_r +// f_a := mload(f_a) +// f_r := add(f_a, calldatasize()) +// let z := mload(2) +// } diff --git a/test/libyul/yulOptimizerTests/blockFlattener/for_stmt.yul b/test/libyul/yulOptimizerTests/blockFlattener/for_stmt.yul new file mode 100644 index 00000000..07bd5c18 --- /dev/null +++ b/test/libyul/yulOptimizerTests/blockFlattener/for_stmt.yul @@ -0,0 +1,19 @@ +{ + for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) } { + a := add(a, 1) + } +} +// ---- +// blockFlattener +// { +// for { +// let a := 1 +// } +// iszero(eq(a, 10)) +// { +// a := add(a, 1) +// } +// { +// a := add(a, 1) +// } +// } diff --git a/test/libyul/yulOptimizerTests/blockFlattener/if_stmt.yul b/test/libyul/yulOptimizerTests/blockFlattener/if_stmt.yul new file mode 100644 index 00000000..4d6ccf0e --- /dev/null +++ b/test/libyul/yulOptimizerTests/blockFlattener/if_stmt.yul @@ -0,0 +1,20 @@ +{ + if add(mload(7), sload(mload(3))) + { + let y := add(mload(3), 3) + { + y := add(y, 7) + } + } + let t := add(3, 9) +} +// ---- +// blockFlattener +// { +// if add(mload(7), sload(mload(3))) +// { +// let y := add(mload(3), 3) +// y := add(y, 7) +// } +// let t := add(3, 9) +// } diff --git a/test/libyul/yulOptimizerTests/blockFlattener/many_nested_blocks.yul b/test/libyul/yulOptimizerTests/blockFlattener/many_nested_blocks.yul new file mode 100644 index 00000000..ae2a066b --- /dev/null +++ b/test/libyul/yulOptimizerTests/blockFlattener/many_nested_blocks.yul @@ -0,0 +1,28 @@ +{ + let a := 3 + let b := 4 + { + a := add(b, 3) + let c := 5 + { + b := add(b, 4) + { + c := add(a, 5) + } + b := add(a, b) + } + a := add(a, c) + } +} +// ---- +// blockFlattener +// { +// let a := 3 +// let b := 4 +// a := add(b, 3) +// let c := 5 +// b := add(b, 4) +// c := add(a, 5) +// b := add(a, b) +// a := add(a, c) +// } |