aboutsummaryrefslogtreecommitdiffstats
path: root/test/libyul/yulOptimizerTests
diff options
context:
space:
mode:
authorChristian Parpart <christian@ethereum.org>2018-10-15 17:52:35 +0800
committerChristian Parpart <christian@ethereum.org>2018-10-15 17:52:35 +0800
commit9a4bec7e474a310c7f93ff3b84928e0e9ba9cce6 (patch)
tree2668ab22a40aad2448081f7bf22c7235d4b4c963 /test/libyul/yulOptimizerTests
parentb965fd6e17f77e94afeb070a27182251b85b8ab3 (diff)
downloaddexon-solidity-9a4bec7e474a310c7f93ff3b84928e0e9ba9cce6.tar.gz
dexon-solidity-9a4bec7e474a310c7f93ff3b84928e0e9ba9cce6.tar.zst
dexon-solidity-9a4bec7e474a310c7f93ff3b84928e0e9ba9cce6.zip
Renaming libjulia to libyul
Diffstat (limited to 'test/libyul/yulOptimizerTests')
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_for.yul24
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_if.yul15
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr.yul10
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr2.yul10
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/smoke.yul5
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/trivial.yul10
-rw-r--r--test/libyul/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul27
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/for_statement.yul28
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/funtion_call.yul22
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/if_statement.yul22
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/smoke.yul5
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/smoke_yul.yul6
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/switch_statement.yul27
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/variables.yul12
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/variables_clash.yul13
-rw-r--r--test/libyul/yulOptimizerTests/disambiguator/variables_inside_functions.yul24
-rw-r--r--test/libyul/yulOptimizerTests/expressionInliner/complex_with_evm.yul13
-rw-r--r--test/libyul/yulOptimizerTests/expressionInliner/double_calls.yul18
-rw-r--r--test/libyul/yulOptimizerTests/expressionInliner/double_recursive_calls.yul18
-rw-r--r--test/libyul/yulOptimizerTests/expressionInliner/no_inline_mload.yul14
-rw-r--r--test/libyul/yulOptimizerTests/expressionInliner/no_move_with_sideeffects.yul27
-rw-r--r--test/libyul/yulOptimizerTests/expressionInliner/simple.yul14
-rw-r--r--test/libyul/yulOptimizerTests/expressionInliner/with_args.yul14
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/if_condition.yul21
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/muli_wrong_order3.yul13
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/multi.yul11
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/multi_reference.yul11
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order.yul15
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order2.yul12
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_across_blocks.yul19
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition1.yul15
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition2.yul16
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/only_assignment.yul16
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/reassignment.yul13
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/simple.yul10
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/single_wrong_order.yul13
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/smoke.yul5
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/switch_expression.yul28
-rw-r--r--test/libyul/yulOptimizerTests/expressionJoiner/triple.yul12
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/constant_propagation.yul6
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/constants.yul6
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul6
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_negative.yul6
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_simple.yul10
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/including_function_calls.yul12
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/inside_for.yul16
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/invariant.yul10
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_1.yul8
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_2.yul8
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_arguments.yul12
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_names.yul16
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul13
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_removes_non_constant_and_not_movable.yul10
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/reversed.yul8
-rw-r--r--test/libyul/yulOptimizerTests/expressionSimplifier/smoke.yul5
-rw-r--r--test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul40
-rw-r--r--test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul29
-rw-r--r--test/libyul/yulOptimizerTests/expressionSplitter/smoke.yul5
-rw-r--r--test/libyul/yulOptimizerTests/expressionSplitter/switch.yul33
-rw-r--r--test/libyul/yulOptimizerTests/expressionSplitter/trivial.yul14
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul32
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul28
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul40
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/multi_return.yul21
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/no_return.yul22
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/pop_result.yul28
-rw-r--r--test/libyul/yulOptimizerTests/fullInliner/simple.yul26
-rw-r--r--test/libyul/yulOptimizerTests/functionGrouper/empty_block.yul24
-rw-r--r--test/libyul/yulOptimizerTests/functionGrouper/multi_fun_mixed.yul24
-rw-r--r--test/libyul/yulOptimizerTests/functionGrouper/nested_fun.yul27
-rw-r--r--test/libyul/yulOptimizerTests/functionGrouper/single_fun.yul14
-rw-r--r--test/libyul/yulOptimizerTests/functionGrouper/smoke.yul7
-rw-r--r--test/libyul/yulOptimizerTests/functionHoister/empty_block.yul26
-rw-r--r--test/libyul/yulOptimizerTests/functionHoister/multi_mixed.yul23
-rw-r--r--test/libyul/yulOptimizerTests/functionHoister/nested.yul23
-rw-r--r--test/libyul/yulOptimizerTests/functionHoister/single.yul13
-rw-r--r--test/libyul/yulOptimizerTests/functionHoister/smoke.yul6
-rw-r--r--test/libyul/yulOptimizerTests/mainFunction/empty_block.yul33
-rw-r--r--test/libyul/yulOptimizerTests/mainFunction/multi_fun_mixed.yul26
-rw-r--r--test/libyul/yulOptimizerTests/mainFunction/nested_fun.yul26
-rw-r--r--test/libyul/yulOptimizerTests/mainFunction/sigle_fun.yul16
-rw-r--r--test/libyul/yulOptimizerTests/mainFunction/smoke.yul9
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/branches_for1.yul21
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/branches_for2.yul25
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init1.yul23
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init2.yul24
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/branches_if.yul18
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/branches_switch.yul24
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/do_not_move_out_of_scope.yul19
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code1.yul10
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code2.yul10
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/expression.yul10
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/non_movable_function.yul18
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/non_movable_instruction.yul14
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/reassign.yul21
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/reassignment.yul19
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/smoke.yul5
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/trivial.yul12
-rw-r--r--test/libyul/yulOptimizerTests/rematerialiser/update_asignment_remat.yul13
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/functions.yul8
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/intermediate_assignment.yul11
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/intermediate_multi_assignment.yul16
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/multi_assign.yul16
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/multi_assignments.yul12
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/multi_declarations.yul7
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/multi_declare.yul12
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/multi_partial_assignments.yul10
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/smoke.yul5
-rw-r--r--test/libyul/yulOptimizerTests/unusedPruner/trivial.yul10
109 files changed, 1768 insertions, 0 deletions
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_for.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_for.yul
new file mode 100644
index 00000000..c59bced7
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_for.yul
@@ -0,0 +1,24 @@
+{
+ let a := 1 let b := codesize()
+ for { } lt(1, codesize()) { mstore(1, codesize()) a := add(a, codesize()) } {
+ mstore(1, codesize())
+ }
+ mstore(1, codesize())
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let a := 1
+// let b := codesize()
+// for {
+// }
+// lt(1, b)
+// {
+// mstore(1, b)
+// a := add(a, b)
+// }
+// {
+// mstore(1, b)
+// }
+// mstore(1, b)
+// }
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_if.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_if.yul
new file mode 100644
index 00000000..5b8200d9
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/branches_if.yul
@@ -0,0 +1,15 @@
+{
+ let b := 1
+ if b { b := 1 }
+ let c := 1
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let b := 1
+// if b
+// {
+// b := b
+// }
+// let c := 1
+// }
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr.yul
new file mode 100644
index 00000000..cb0ca38d
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr.yul
@@ -0,0 +1,10 @@
+{
+ let a := mload(1)
+ let b := mload(1)
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let a := mload(1)
+// let b := mload(1)
+// }
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr2.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr2.yul
new file mode 100644
index 00000000..ebc17446
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/non_movable_instr2.yul
@@ -0,0 +1,10 @@
+{
+ let a := gas()
+ let b := gas()
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let a := gas()
+// let b := gas()
+// }
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/smoke.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/smoke.yul
new file mode 100644
index 00000000..b9457229
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/smoke.yul
@@ -0,0 +1,5 @@
+{ }
+// ----
+// commonSubexpressionEliminator
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/trivial.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/trivial.yul
new file mode 100644
index 00000000..684272f5
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/trivial.yul
@@ -0,0 +1,10 @@
+{
+ let a := mul(1, codesize())
+ let b := mul(1, codesize())
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let a := mul(1, codesize())
+// let b := a
+// }
diff --git a/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul
new file mode 100644
index 00000000..ab94afc2
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/commonSubexpressionEliminator/variable_for_variable.yul
@@ -0,0 +1,27 @@
+{
+
+ let a := mload(0)
+ let b := add(a, 7)
+ let c := a
+ let d := c
+ let x := add(a, b)
+ // CSE has to recognize equality with x here.
+ let y := add(d, add(c, 7))
+ // some reassignments
+ b := mload(a)
+ a := b
+ mstore(2, a)
+}
+// ----
+// commonSubexpressionEliminator
+// {
+// let a := mload(0)
+// let b := add(a, 7)
+// let c := a
+// let d := a
+// let x := add(a, b)
+// let y := x
+// b := mload(a)
+// a := b
+// mstore(2, b)
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/for_statement.yul b/test/libyul/yulOptimizerTests/disambiguator/for_statement.yul
new file mode 100644
index 00000000..0d2a38c5
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/for_statement.yul
@@ -0,0 +1,28 @@
+// yul
+{
+ { let a:u256, b:u256 }
+ {
+ for { let a:u256 } a { a := a } {
+ let b:u256 := a
+ }
+ }
+}
+// ----
+// disambiguator
+// {
+// {
+// let a:u256, b:u256
+// }
+// {
+// for {
+// let a_1:u256
+// }
+// a_1
+// {
+// a_1 := a_1
+// }
+// {
+// let b_1:u256 := a_1
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/funtion_call.yul b/test/libyul/yulOptimizerTests/disambiguator/funtion_call.yul
new file mode 100644
index 00000000..f917bb68
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/funtion_call.yul
@@ -0,0 +1,22 @@
+// yul
+{
+ { let a:u256, b:u256, c:u256, d:u256, f:u256 }
+ {
+ function f(a:u256) -> c:u256, d:u256 {
+ let b:u256, c_1:u256 := f(a)
+ }
+ }
+}
+// ----
+// disambiguator
+// {
+// {
+// let a:u256, b:u256, c:u256, d:u256, f:u256
+// }
+// {
+// function f_1(a_1:u256) -> c_1:u256, d_1:u256
+// {
+// let b_1:u256, c_1_1:u256 := f_1(a_1)
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/if_statement.yul b/test/libyul/yulOptimizerTests/disambiguator/if_statement.yul
new file mode 100644
index 00000000..14f53757
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/if_statement.yul
@@ -0,0 +1,22 @@
+// yul
+{
+ { let a:u256, b:u256, c:u256 }
+ {
+ let a:bool
+ if a { let b:bool := a }
+ }
+}
+// ----
+// disambiguator
+// {
+// {
+// let a:u256, b:u256, c:u256
+// }
+// {
+// let a_1:bool
+// if a_1
+// {
+// let b_1:bool := a_1
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/smoke.yul b/test/libyul/yulOptimizerTests/disambiguator/smoke.yul
new file mode 100644
index 00000000..d6cd8a61
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/smoke.yul
@@ -0,0 +1,5 @@
+{ }
+// ----
+// disambiguator
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/smoke_yul.yul b/test/libyul/yulOptimizerTests/disambiguator/smoke_yul.yul
new file mode 100644
index 00000000..e55f4cd3
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/smoke_yul.yul
@@ -0,0 +1,6 @@
+// yul
+{ }
+// ----
+// disambiguator
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/switch_statement.yul b/test/libyul/yulOptimizerTests/disambiguator/switch_statement.yul
new file mode 100644
index 00000000..340ecccf
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/switch_statement.yul
@@ -0,0 +1,27 @@
+// yul
+{
+ { let a:u256, b:u256, c:u256 }
+ {
+ let a:u256
+ switch a
+ case 0:u256 { let b:u256 := a }
+ default { let c:u256 := a }
+ }
+}
+// ----
+// disambiguator
+// {
+// {
+// let a:u256, b:u256, c:u256
+// }
+// {
+// let a_1:u256
+// switch a_1
+// case 0:u256 {
+// let b_1:u256 := a_1
+// }
+// default {
+// let c_1:u256 := a_1
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/variables.yul b/test/libyul/yulOptimizerTests/disambiguator/variables.yul
new file mode 100644
index 00000000..65bd4c8f
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/variables.yul
@@ -0,0 +1,12 @@
+// yul
+{ { let a:u256 } { let a:u256 } }
+// ----
+// disambiguator
+// {
+// {
+// let a:u256
+// }
+// {
+// let a_1:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/variables_clash.yul b/test/libyul/yulOptimizerTests/disambiguator/variables_clash.yul
new file mode 100644
index 00000000..e462442a
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/variables_clash.yul
@@ -0,0 +1,13 @@
+// yul
+{ { let a:u256 let a_1:u256 } { let a:u256 } }
+// ----
+// disambiguator
+// {
+// {
+// let a:u256
+// let a_1:u256
+// }
+// {
+// let a_2:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/disambiguator/variables_inside_functions.yul b/test/libyul/yulOptimizerTests/disambiguator/variables_inside_functions.yul
new file mode 100644
index 00000000..e80959f6
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/disambiguator/variables_inside_functions.yul
@@ -0,0 +1,24 @@
+// yul
+{
+ { let c:u256 let b:u256 }
+ function f(a:u256, c:u256) -> b:u256 { let x:u256 }
+ {
+ let a:u256 let x:u256
+ }
+}
+// ----
+// disambiguator
+// {
+// {
+// let c:u256
+// let b:u256
+// }
+// function f(a:u256, c_1:u256) -> b_1:u256
+// {
+// let x:u256
+// }
+// {
+// let a_1:u256
+// let x_1:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionInliner/complex_with_evm.yul b/test/libyul/yulOptimizerTests/expressionInliner/complex_with_evm.yul
new file mode 100644
index 00000000..519a2af8
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionInliner/complex_with_evm.yul
@@ -0,0 +1,13 @@
+{
+ function f(a) -> x { x := add(a, a) }
+ let y := f(calldatasize())
+}
+// ----
+// expressionInliner
+// {
+// function f(a) -> x
+// {
+// x := add(a, a)
+// }
+// let y := add(calldatasize(), calldatasize())
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionInliner/double_calls.yul b/test/libyul/yulOptimizerTests/expressionInliner/double_calls.yul
new file mode 100644
index 00000000..e1da8e07
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionInliner/double_calls.yul
@@ -0,0 +1,18 @@
+{
+ function f(a) -> x { x := add(a, a) }
+ function g(b, c) -> y { y := mul(mload(c), f(b)) }
+ let y := g(calldatasize(), 7)
+}
+// ----
+// expressionInliner
+// {
+// function f(a) -> x
+// {
+// x := add(a, a)
+// }
+// function g(b, c) -> y
+// {
+// y := mul(mload(c), add(b, b))
+// }
+// let y_1 := mul(mload(7), add(calldatasize(), calldatasize()))
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionInliner/double_recursive_calls.yul b/test/libyul/yulOptimizerTests/expressionInliner/double_recursive_calls.yul
new file mode 100644
index 00000000..082cb53f
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionInliner/double_recursive_calls.yul
@@ -0,0 +1,18 @@
+{
+ function f(a, r) -> x { x := g(a, g(r, r)) }
+ function g(b, s) -> y { y := f(b, f(s, s)) }
+ let y := g(calldatasize(), 7)
+}
+// ----
+// expressionInliner
+// {
+// function f(a, r) -> x
+// {
+// x := g(a, f(r, f(r, r)))
+// }
+// function g(b, s) -> y
+// {
+// y := f(b, g(s, f(s, f(s, s))))
+// }
+// let y_1 := f(calldatasize(), g(7, f(7, f(7, 7))))
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionInliner/no_inline_mload.yul b/test/libyul/yulOptimizerTests/expressionInliner/no_inline_mload.yul
new file mode 100644
index 00000000..0fb43a9d
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionInliner/no_inline_mload.yul
@@ -0,0 +1,14 @@
+// Does not inline because mload could be moved out of sequence
+{
+ function f(a) -> x { x := a }
+ let y := f(mload(2))
+}
+// ----
+// expressionInliner
+// {
+// function f(a) -> x
+// {
+// x := a
+// }
+// let y := f(mload(2))
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionInliner/no_move_with_sideeffects.yul b/test/libyul/yulOptimizerTests/expressionInliner/no_move_with_sideeffects.yul
new file mode 100644
index 00000000..7fdad6c4
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionInliner/no_move_with_sideeffects.yul
@@ -0,0 +1,27 @@
+// The calls to g and h cannot be moved because g and h are not movable. Therefore, the call
+// to f is not inlined.
+{
+ function f(a, b) -> x { x := add(b, a) }
+ function g() -> y { y := mload(0) mstore(0, 4) }
+ function h() -> z { mstore(0, 4) z := mload(0) }
+ let r := f(g(), h())
+}
+// ----
+// expressionInliner
+// {
+// function f(a, b) -> x
+// {
+// x := add(b, a)
+// }
+// function g() -> y
+// {
+// y := mload(0)
+// mstore(0, 4)
+// }
+// function h() -> z
+// {
+// mstore(0, 4)
+// z := mload(0)
+// }
+// let r := f(g(), h())
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionInliner/simple.yul b/test/libyul/yulOptimizerTests/expressionInliner/simple.yul
new file mode 100644
index 00000000..c186eafd
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionInliner/simple.yul
@@ -0,0 +1,14 @@
+// yul
+{
+ function f() -> x:u256 { x := 2:u256 }
+ let y:u256 := f()
+}
+// ----
+// expressionInliner
+// {
+// function f() -> x:u256
+// {
+// x := 2:u256
+// }
+// let y:u256 := 2:u256
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionInliner/with_args.yul b/test/libyul/yulOptimizerTests/expressionInliner/with_args.yul
new file mode 100644
index 00000000..b5f4d515
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionInliner/with_args.yul
@@ -0,0 +1,14 @@
+// yul
+{
+ function f(a:u256) -> x:u256 { x := a }
+ let y:u256 := f(7:u256)
+}
+// ----
+// expressionInliner
+// {
+// function f(a:u256) -> x:u256
+// {
+// x := a
+// }
+// let y:u256 := 7:u256
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/if_condition.yul b/test/libyul/yulOptimizerTests/expressionJoiner/if_condition.yul
new file mode 100644
index 00000000..a1349511
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/if_condition.yul
@@ -0,0 +1,21 @@
+{
+ let a := mload(3)
+ let b := sload(a)
+ let c := mload(7)
+ let d := add(c, b)
+ if d {
+ let x := mload(3)
+ let y := add(x, 3)
+ }
+ let z := 3
+ let t := add(z, 9)
+}
+// ----
+// expressionJoiner
+// {
+// if add(mload(7), sload(mload(3)))
+// {
+// let y := add(mload(3), 3)
+// }
+// let t := add(3, 9)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/muli_wrong_order3.yul b/test/libyul/yulOptimizerTests/expressionJoiner/muli_wrong_order3.yul
new file mode 100644
index 00000000..0d407c7c
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/muli_wrong_order3.yul
@@ -0,0 +1,13 @@
+{
+ let a := mload(3)
+ let b := mload(6)
+ let x := mul(add(b, a), mload(2))
+ sstore(x, 3)
+}
+// ----
+// expressionJoiner
+// {
+// let a := mload(3)
+// let b := mload(6)
+// sstore(mul(add(b, a), mload(2)), 3)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/multi.yul b/test/libyul/yulOptimizerTests/expressionJoiner/multi.yul
new file mode 100644
index 00000000..fd53ca51
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/multi.yul
@@ -0,0 +1,11 @@
+{
+ let a := mload(2)
+ let b := mload(6)
+ let x := mul(add(b, a), 2)
+ sstore(x, 3)
+}
+// ----
+// expressionJoiner
+// {
+// sstore(mul(add(mload(6), mload(2)), 2), 3)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/multi_reference.yul b/test/libyul/yulOptimizerTests/expressionJoiner/multi_reference.yul
new file mode 100644
index 00000000..078a12a5
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/multi_reference.yul
@@ -0,0 +1,11 @@
+{
+ // This is not joined because a is referenced multiple times
+ let a := mload(2)
+ let b := add(a, a)
+}
+// ----
+// expressionJoiner
+// {
+// let a := mload(2)
+// let b := add(a, a)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order.yul b/test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order.yul
new file mode 100644
index 00000000..965e07e9
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order.yul
@@ -0,0 +1,15 @@
+{
+ // We have an interleaved "add" here, so we cannot inline "a"
+ // (note that this component does not analyze whether
+ // functions are pure or not)
+ let a := mload(2)
+ let b := mload(6)
+ let x := mul(a, add(2, b))
+ sstore(x, 3)
+}
+// ----
+// expressionJoiner
+// {
+// let a := mload(2)
+// sstore(mul(a, add(2, mload(6))), 3)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order2.yul b/test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order2.yul
new file mode 100644
index 00000000..c577e182
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/multi_wrong_order2.yul
@@ -0,0 +1,12 @@
+{
+ let a := mload(2)
+ let b := mload(6)
+ let x := mul(add(a, b), 2)
+ sstore(x, 3)
+}
+// ----
+// expressionJoiner
+// {
+// let a := mload(2)
+// sstore(mul(add(a, mload(6)), 2), 3)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_across_blocks.yul b/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_across_blocks.yul
new file mode 100644
index 00000000..a781bb2a
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_across_blocks.yul
@@ -0,0 +1,19 @@
+{
+ // The component will remove the empty block after
+ // it has handled the outer block.
+ // The idea behind this test is that the component
+ // does not perform replacements across blocks because
+ // they usually have contents, but adding contents
+ // will reduce the scope of the test.
+ let a := mload(2)
+ let x := calldataload(a)
+ {
+ }
+ sstore(x, 3)
+}
+// ----
+// expressionJoiner
+// {
+// let x := calldataload(mload(2))
+// sstore(x, 3)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition1.yul b/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition1.yul
new file mode 100644
index 00000000..75218a5c
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition1.yul
@@ -0,0 +1,15 @@
+{
+ for { let b := mload(1) } b {} {}
+}
+// ----
+// expressionJoiner
+// {
+// for {
+// let b := mload(1)
+// }
+// b
+// {
+// }
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition2.yul b/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition2.yul
new file mode 100644
index 00000000..d5f7d8fa
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/no_replacement_in_loop_condition2.yul
@@ -0,0 +1,16 @@
+{
+ let a := mload(0)
+ for { } a {} {}
+}
+// ----
+// expressionJoiner
+// {
+// let a := mload(0)
+// for {
+// }
+// a
+// {
+// }
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/only_assignment.yul b/test/libyul/yulOptimizerTests/expressionJoiner/only_assignment.yul
new file mode 100644
index 00000000..c7411211
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/only_assignment.yul
@@ -0,0 +1,16 @@
+{
+ // This is not joined because a is referenced multiple times
+ function f(a) -> x {
+ a := mload(2)
+ x := add(a, 3)
+ }
+}
+// ----
+// expressionJoiner
+// {
+// function f(a) -> x
+// {
+// a := mload(2)
+// x := add(a, 3)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/reassignment.yul b/test/libyul/yulOptimizerTests/expressionJoiner/reassignment.yul
new file mode 100644
index 00000000..1e502353
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/reassignment.yul
@@ -0,0 +1,13 @@
+{
+ // This is not joined because a is referenced multiple times
+ let a := mload(2)
+ let b := mload(a)
+ a := 4
+}
+// ----
+// expressionJoiner
+// {
+// let a := mload(2)
+// let b := mload(a)
+// a := 4
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/simple.yul b/test/libyul/yulOptimizerTests/expressionJoiner/simple.yul
new file mode 100644
index 00000000..b03bcf45
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/simple.yul
@@ -0,0 +1,10 @@
+{
+ let a := mload(2)
+ let x := calldataload(a)
+ sstore(x, 3)
+}
+// ----
+// expressionJoiner
+// {
+// sstore(calldataload(mload(2)), 3)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/single_wrong_order.yul b/test/libyul/yulOptimizerTests/expressionJoiner/single_wrong_order.yul
new file mode 100644
index 00000000..3b433f78
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/single_wrong_order.yul
@@ -0,0 +1,13 @@
+{
+ let a := mload(3)
+ let b := sload(a)
+ let c := mload(7)
+ let d := add(b, c)
+ sstore(d, 0)
+}
+// ----
+// expressionJoiner
+// {
+// let b := sload(mload(3))
+// sstore(add(b, mload(7)), 0)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/smoke.yul b/test/libyul/yulOptimizerTests/expressionJoiner/smoke.yul
new file mode 100644
index 00000000..c0e2c6f2
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/smoke.yul
@@ -0,0 +1,5 @@
+{ }
+// ----
+// expressionJoiner
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/switch_expression.yul b/test/libyul/yulOptimizerTests/expressionJoiner/switch_expression.yul
new file mode 100644
index 00000000..0e4e540e
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/switch_expression.yul
@@ -0,0 +1,28 @@
+{
+ let a := mload(3)
+ let b := sload(a)
+ let c := mload(7)
+ let d := add(c, b)
+ switch d
+ case 3 {
+ let x := mload(3)
+ let y := add(x, 3)
+ }
+ default {
+ sstore(1, 0)
+ }
+ let z := 3
+ let t := add(z, 9)
+}
+// ----
+// expressionJoiner
+// {
+// switch add(mload(7), sload(mload(3)))
+// case 3 {
+// let y := add(mload(3), 3)
+// }
+// default {
+// sstore(1, 0)
+// }
+// let t := add(3, 9)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionJoiner/triple.yul b/test/libyul/yulOptimizerTests/expressionJoiner/triple.yul
new file mode 100644
index 00000000..7b722be1
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionJoiner/triple.yul
@@ -0,0 +1,12 @@
+{
+ let a := mload(2)
+ let b := mload(6)
+ let c := mload(7)
+ let x := mul(add(c, b), a)
+ sstore(x, 3)
+}
+// ----
+// expressionJoiner
+// {
+// sstore(mul(add(mload(7), mload(6)), mload(2)), 3)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/constant_propagation.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/constant_propagation.yul
new file mode 100644
index 00000000..0b55adc5
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/constant_propagation.yul
@@ -0,0 +1,6 @@
+{ let a := add(7, sub(mload(0), 7)) }
+// ----
+// expressionSimplifier
+// {
+// let a := mload(0)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/constants.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/constants.yul
new file mode 100644
index 00000000..bd1a5a53
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/constants.yul
@@ -0,0 +1,6 @@
+{ let a := add(1, mul(3, 4)) }
+// ----
+// expressionSimplifier
+// {
+// let a := 13
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul
new file mode 100644
index 00000000..f6190622
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_complex.yul
@@ -0,0 +1,6 @@
+{ let a := sub(calldataload(0), calldataload(0)) }
+// ----
+// expressionSimplifier
+// {
+// let a := 0
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_negative.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_negative.yul
new file mode 100644
index 00000000..e91403cd
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_negative.yul
@@ -0,0 +1,6 @@
+{ let a := sub(calldataload(1), calldataload(0)) }
+// ----
+// expressionSimplifier
+// {
+// let a := sub(calldataload(1), calldataload(0))
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_simple.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_simple.yul
new file mode 100644
index 00000000..d35686cd
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/identity_rules_simple.yul
@@ -0,0 +1,10 @@
+{
+ let a := mload(0)
+ let b := sub(a, a)
+}
+// ----
+// expressionSimplifier
+// {
+// let a := mload(0)
+// let b := 0
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/including_function_calls.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/including_function_calls.yul
new file mode 100644
index 00000000..c2ca504a
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/including_function_calls.yul
@@ -0,0 +1,12 @@
+{
+ function f() -> a {}
+ let b := add(7, sub(f(), 7))
+}
+// ----
+// expressionSimplifier
+// {
+// function f() -> a
+// {
+// }
+// let b := f()
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/inside_for.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/inside_for.yul
new file mode 100644
index 00000000..42c37826
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/inside_for.yul
@@ -0,0 +1,16 @@
+{
+ for { let a := 10 } iszero(eq(a, 0)) { a := add(a, 1) } {}
+}
+// ----
+// expressionSimplifier
+// {
+// for {
+// let a := 10
+// }
+// iszero(iszero(a))
+// {
+// a := add(a, 1)
+// }
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/invariant.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/invariant.yul
new file mode 100644
index 00000000..e6d84552
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/invariant.yul
@@ -0,0 +1,10 @@
+{
+ let a := mload(sub(7, 7))
+ let b := sub(a, 0)
+}
+// ----
+// expressionSimplifier
+// {
+// let a := mload(0)
+// let b := a
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_1.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_1.yul
new file mode 100644
index 00000000..88714ce0
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_1.yul
@@ -0,0 +1,8 @@
+{
+ mstore(0, mod(calldataload(0), exp(2, 8)))
+}
+// ----
+// expressionSimplifier
+// {
+// mstore(0, and(calldataload(0), 255))
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_2.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_2.yul
new file mode 100644
index 00000000..4d52abe8
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/mod_and_2.yul
@@ -0,0 +1,8 @@
+{
+ mstore(0, mod(calldataload(0), exp(2, 255)))
+}
+// ----
+// expressionSimplifier
+// {
+// mstore(0, and(calldataload(0), 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff))
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_arguments.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_arguments.yul
new file mode 100644
index 00000000..53270b72
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_arguments.yul
@@ -0,0 +1,12 @@
+{
+ function f(a) -> b { }
+ let c := sub(f(0), f(1))
+}
+// ----
+// expressionSimplifier
+// {
+// function f(a) -> b
+// {
+// }
+// let c := sub(f(0), f(1))
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_names.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_names.yul
new file mode 100644
index 00000000..6ab65d29
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_different_names.yul
@@ -0,0 +1,16 @@
+{
+ function f1() -> a { }
+ function f2() -> b { }
+ let c := sub(f1(), f2())
+}
+// ----
+// expressionSimplifier
+// {
+// function f1() -> a
+// {
+// }
+// function f2() -> b
+// {
+// }
+// let c := sub(f1(), f2())
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul
new file mode 100644
index 00000000..ab1bd128
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_function_call_equality_not_movable.yul
@@ -0,0 +1,13 @@
+// Even if the functions pass the equality check, they are not movable.
+{
+ function f() -> a { }
+ let b := sub(f(), f())
+}
+// ----
+// expressionSimplifier
+// {
+// function f() -> a
+// {
+// }
+// let b := sub(f(), f())
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_removes_non_constant_and_not_movable.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_removes_non_constant_and_not_movable.yul
new file mode 100644
index 00000000..fc61c3df
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/not_applied_removes_non_constant_and_not_movable.yul
@@ -0,0 +1,10 @@
+// The first argument of div is not constant.
+// keccak256 is not movable.
+{
+ let a := div(keccak256(0, 0), 0)
+}
+// ----
+// expressionSimplifier
+// {
+// let a := div(keccak256(0, 0), 0)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/reversed.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/reversed.yul
new file mode 100644
index 00000000..6353cda9
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/reversed.yul
@@ -0,0 +1,8 @@
+{
+ let a := add(0, mload(0))
+}
+// ----
+// expressionSimplifier
+// {
+// let a := mload(0)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSimplifier/smoke.yul b/test/libyul/yulOptimizerTests/expressionSimplifier/smoke.yul
new file mode 100644
index 00000000..88420e92
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSimplifier/smoke.yul
@@ -0,0 +1,5 @@
+{ }
+// ----
+// expressionSimplifier
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul b/test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul
new file mode 100644
index 00000000..d021129f
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSplitter/control_flow.yul
@@ -0,0 +1,40 @@
+{
+ let x := calldataload(0)
+ if mul(add(x, 2), 3) {
+ for { let a := 2 } lt(a, mload(a)) { a := add(a, mul(a, 2)) } {
+ let b := mul(add(a, 2), 4)
+ sstore(b, mul(b, 2))
+ }
+ }
+}
+// ----
+// expressionSplitter
+// {
+// let _1 := 0
+// let x := calldataload(_1)
+// let _2 := 3
+// let _3 := 2
+// let _4 := add(x, _3)
+// let _5 := mul(_4, _2)
+// if _5
+// {
+// for {
+// let a := 2
+// }
+// lt(a, mload(a))
+// {
+// let _6 := 2
+// let _7 := mul(a, _6)
+// a := add(a, _7)
+// }
+// {
+// let _8 := 4
+// let _9 := 2
+// let _10 := add(a, _9)
+// let b := mul(_10, _8)
+// let _11 := 2
+// let _12 := mul(b, _11)
+// sstore(b, _12)
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul b/test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul
new file mode 100644
index 00000000..53bbcea7
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSplitter/inside_function.yul
@@ -0,0 +1,29 @@
+{
+ let x := mul(f(0, mload(7)), 3)
+ function f(a, b) -> c {
+ c := mul(a, mload(add(b, c)))
+ }
+ sstore(x, f(mload(2), mload(2)))
+}
+// ----
+// expressionSplitter
+// {
+// let _1 := 3
+// let _2 := 7
+// let _3 := mload(_2)
+// let _4 := 0
+// let _5 := f(_4, _3)
+// let x := mul(_5, _1)
+// function f(a, b) -> c
+// {
+// let _6 := add(b, c)
+// let _7 := mload(_6)
+// c := mul(a, _7)
+// }
+// let _8 := 2
+// let _9 := mload(_8)
+// let _10 := 2
+// let _11 := mload(_10)
+// let _12 := f(_11, _9)
+// sstore(x, _12)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/smoke.yul b/test/libyul/yulOptimizerTests/expressionSplitter/smoke.yul
new file mode 100644
index 00000000..f69f60b6
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSplitter/smoke.yul
@@ -0,0 +1,5 @@
+{ }
+// ----
+// expressionSplitter
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/switch.yul b/test/libyul/yulOptimizerTests/expressionSplitter/switch.yul
new file mode 100644
index 00000000..aee7976f
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSplitter/switch.yul
@@ -0,0 +1,33 @@
+{
+ let x := 8
+ switch add(2, calldataload(0))
+ case 0 { sstore(0, mload(2)) }
+ default { mstore(0, mload(3)) }
+ x := add(mload(3), 4)
+}
+// ----
+// expressionSplitter
+// {
+// let x := 8
+// let _1 := 0
+// let _2 := calldataload(_1)
+// let _3 := 2
+// let _4 := add(_3, _2)
+// switch _4
+// case 0 {
+// let _5 := 2
+// let _6 := mload(_5)
+// let _7 := 0
+// sstore(_7, _6)
+// }
+// default {
+// let _8 := 3
+// let _9 := mload(_8)
+// let _10 := 0
+// mstore(_10, _9)
+// }
+// let _11 := 4
+// let _12 := 3
+// let _13 := mload(_12)
+// x := add(_13, _11)
+// }
diff --git a/test/libyul/yulOptimizerTests/expressionSplitter/trivial.yul b/test/libyul/yulOptimizerTests/expressionSplitter/trivial.yul
new file mode 100644
index 00000000..bff70cd8
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/expressionSplitter/trivial.yul
@@ -0,0 +1,14 @@
+{
+ mstore(add(calldataload(2), mload(3)), 8)
+}
+// ----
+// expressionSplitter
+// {
+// let _1 := 8
+// let _2 := 3
+// let _3 := mload(_2)
+// let _4 := 2
+// let _5 := calldataload(_4)
+// let _6 := add(_5, _3)
+// mstore(_6, _1)
+// }
diff --git a/test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul b/test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul
new file mode 100644
index 00000000..ae25e9a3
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/inside_condition.yul
@@ -0,0 +1,32 @@
+// This tests that breaking the expression inside the condition works properly.
+{
+ if gt(f(mload(1)), mload(0)) {
+ sstore(0, 2)
+ }
+ function f(a) -> r {
+ a := mload(a)
+ r := add(a, calldatasize())
+ }
+}
+// ----
+// fullInliner
+// {
+// {
+// let _1 := mload(0)
+// let f_a := mload(1)
+// let f_r
+// {
+// f_a := mload(f_a)
+// f_r := add(f_a, calldatasize())
+// }
+// if gt(f_r, _1)
+// {
+// sstore(0, 2)
+// }
+// }
+// function f(a) -> r
+// {
+// a := mload(a)
+// r := add(a, calldatasize())
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul b/test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul
new file mode 100644
index 00000000..e1def585
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/move_up_rightwards_argument.yul
@@ -0,0 +1,28 @@
+{
+ function f(a, b, c) -> x {
+ x := add(a, b)
+ x := mul(x, c)
+ }
+ let y := add(mload(1), add(f(mload(2), mload(3), mload(4)), mload(5)))
+}
+// ----
+// fullInliner
+// {
+// {
+// let _1 := mload(5)
+// let f_c := mload(4)
+// let f_b := mload(3)
+// let f_a := mload(2)
+// let f_x
+// {
+// f_x := add(f_a, f_b)
+// f_x := mul(f_x, f_c)
+// }
+// let y := add(mload(1), add(f_x, _1))
+// }
+// function f(a, b, c) -> x
+// {
+// x := add(a, b)
+// x := mul(x, c)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul b/test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul
new file mode 100644
index 00000000..94bbe5dc
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/multi_fun.yul
@@ -0,0 +1,40 @@
+{
+ function f(a) -> x { x := add(a, a) }
+ function g(b, c) -> y { y := mul(mload(c), f(b)) }
+ let y := g(f(3), 7)
+}
+// ----
+// fullInliner
+// {
+// {
+// let g_c := 7
+// let f_a_1 := 3
+// let f_x_1
+// {
+// f_x_1 := add(f_a_1, f_a_1)
+// }
+// let g_y
+// {
+// let g_f_a := f_x_1
+// let g_f_x
+// {
+// g_f_x := add(g_f_a, g_f_a)
+// }
+// g_y := mul(mload(g_c), g_f_x)
+// }
+// let y_1 := g_y
+// }
+// function f(a) -> x
+// {
+// x := add(a, a)
+// }
+// function g(b, c) -> y
+// {
+// let f_a := b
+// let f_x
+// {
+// f_x := add(f_a, f_a)
+// }
+// y := mul(mload(c), f_x)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/fullInliner/multi_return.yul b/test/libyul/yulOptimizerTests/fullInliner/multi_return.yul
new file mode 100644
index 00000000..f3c5b0ee
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/multi_return.yul
@@ -0,0 +1,21 @@
+// The full inliner currently does not work with
+// functions returning multiple values.
+{
+ function f(a) -> x, y {
+ x := mul(a, a)
+ y := add(a, x)
+ }
+ let a, b := f(mload(0))
+}
+// ----
+// fullInliner
+// {
+// {
+// let a_1, b := f(mload(0))
+// }
+// function f(a) -> x, y
+// {
+// x := mul(a, a)
+// y := add(a, x)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/fullInliner/no_return.yul b/test/libyul/yulOptimizerTests/fullInliner/no_return.yul
new file mode 100644
index 00000000..53fe3527
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/no_return.yul
@@ -0,0 +1,22 @@
+{
+ function f(a) {
+ sstore(a, a)
+ }
+ f(mload(0))
+}
+// ----
+// fullInliner
+// {
+// {
+// let f_a := mload(0)
+// {
+// sstore(f_a, f_a)
+// }
+// {
+// }
+// }
+// function f(a)
+// {
+// sstore(a, a)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/fullInliner/pop_result.yul b/test/libyul/yulOptimizerTests/fullInliner/pop_result.yul
new file mode 100644
index 00000000..3883c67c
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/pop_result.yul
@@ -0,0 +1,28 @@
+// This tests that `pop(r)` is removed.
+{
+ function f(a) -> x {
+ let r := mul(a, a)
+ x := add(r, r)
+ }
+ pop(add(f(7), 2))
+}
+// ----
+// fullInliner
+// {
+// {
+// let _1 := 2
+// let f_a := 7
+// let f_x
+// {
+// let f_r := mul(f_a, f_a)
+// f_x := add(f_r, f_r)
+// }
+// {
+// }
+// }
+// function f(a) -> x
+// {
+// let r := mul(a, a)
+// x := add(r, r)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/fullInliner/simple.yul b/test/libyul/yulOptimizerTests/fullInliner/simple.yul
new file mode 100644
index 00000000..dd1a4e0a
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/fullInliner/simple.yul
@@ -0,0 +1,26 @@
+{
+ function f(a) -> x {
+ let r := mul(a, a)
+ x := add(r, r)
+ }
+ let y := add(f(sload(mload(2))), mload(7))
+}
+// ----
+// fullInliner
+// {
+// {
+// let _1 := mload(7)
+// let f_a := sload(mload(2))
+// let f_x
+// {
+// let f_r := mul(f_a, f_a)
+// f_x := add(f_r, f_r)
+// }
+// let y := add(f_x, _1)
+// }
+// function f(a) -> x
+// {
+// let r := mul(a, a)
+// x := add(r, r)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionGrouper/empty_block.yul b/test/libyul/yulOptimizerTests/functionGrouper/empty_block.yul
new file mode 100644
index 00000000..f0d49d7b
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionGrouper/empty_block.yul
@@ -0,0 +1,24 @@
+// yul
+{ let a:u256 { } function f() -> x:bool { let b:u256 := 4:u256 {} for {} f() {} {} } }
+// ----
+// functionGrouper
+// {
+// {
+// let a:u256
+// {
+// }
+// }
+// function f() -> x:bool
+// {
+// let b:u256 := 4:u256
+// {
+// }
+// for {
+// }
+// f()
+// {
+// }
+// {
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionGrouper/multi_fun_mixed.yul b/test/libyul/yulOptimizerTests/functionGrouper/multi_fun_mixed.yul
new file mode 100644
index 00000000..c830d5da
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionGrouper/multi_fun_mixed.yul
@@ -0,0 +1,24 @@
+// yul
+{
+ let a:u256
+ function f() { let b:u256 }
+ let c:u256 function g() { let d:u256 }
+ let e:u256
+}
+// ----
+// functionGrouper
+// {
+// {
+// let a:u256
+// let c:u256
+// let e:u256
+// }
+// function f()
+// {
+// let b:u256
+// }
+// function g()
+// {
+// let d:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionGrouper/nested_fun.yul b/test/libyul/yulOptimizerTests/functionGrouper/nested_fun.yul
new file mode 100644
index 00000000..4a8be86a
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionGrouper/nested_fun.yul
@@ -0,0 +1,27 @@
+// yul
+{
+ let a:u256
+ function f() {
+ let b:u256
+ function g() {
+ let c:u256
+ }
+ let d:u256
+ }
+}
+// ----
+// functionGrouper
+// {
+// {
+// let a:u256
+// }
+// function f()
+// {
+// let b:u256
+// function g()
+// {
+// let c:u256
+// }
+// let d:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionGrouper/single_fun.yul b/test/libyul/yulOptimizerTests/functionGrouper/single_fun.yul
new file mode 100644
index 00000000..149a44eb
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionGrouper/single_fun.yul
@@ -0,0 +1,14 @@
+// yul
+{
+ let a:u256 function f() {}
+}
+// ----
+// functionGrouper
+// {
+// {
+// let a:u256
+// }
+// function f()
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionGrouper/smoke.yul b/test/libyul/yulOptimizerTests/functionGrouper/smoke.yul
new file mode 100644
index 00000000..650a163e
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionGrouper/smoke.yul
@@ -0,0 +1,7 @@
+{ }
+// ----
+// functionGrouper
+// {
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionHoister/empty_block.yul b/test/libyul/yulOptimizerTests/functionHoister/empty_block.yul
new file mode 100644
index 00000000..6ea9f59d
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionHoister/empty_block.yul
@@ -0,0 +1,26 @@
+// yul
+{
+ let a:u256
+ { }
+ function f() -> x:bool {
+ let b:u256 := 4:u256
+ { }
+ for {} f() {} {}
+ }
+}
+// ----
+// functionHoister
+// {
+// let a:u256
+// function f() -> x:bool
+// {
+// let b:u256 := 4:u256
+// for {
+// }
+// f()
+// {
+// }
+// {
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionHoister/multi_mixed.yul b/test/libyul/yulOptimizerTests/functionHoister/multi_mixed.yul
new file mode 100644
index 00000000..1e3bc5a1
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionHoister/multi_mixed.yul
@@ -0,0 +1,23 @@
+// yul
+{
+ let a:u256
+ function f() { let b:u256 }
+ let c:u256
+ function g() { let d:u256 }
+ let e:u256
+}
+// ----
+// functionHoister
+// {
+// let a:u256
+// let c:u256
+// let e:u256
+// function f()
+// {
+// let b:u256
+// }
+// function g()
+// {
+// let d:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionHoister/nested.yul b/test/libyul/yulOptimizerTests/functionHoister/nested.yul
new file mode 100644
index 00000000..20f094f1
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionHoister/nested.yul
@@ -0,0 +1,23 @@
+// yul
+{
+ let a:u256
+ function f() {
+ let b:u256
+ function g() { let c:u256 }
+ let d:u256
+ }
+}
+// ----
+// functionHoister
+// {
+// let a:u256
+// function g()
+// {
+// let c:u256
+// }
+// function f()
+// {
+// let b:u256
+// let d:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionHoister/single.yul b/test/libyul/yulOptimizerTests/functionHoister/single.yul
new file mode 100644
index 00000000..ba922612
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionHoister/single.yul
@@ -0,0 +1,13 @@
+// yul
+{
+ let a:u256
+ function f() {}
+}
+// ----
+// functionHoister
+// {
+// let a:u256
+// function f()
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/functionHoister/smoke.yul b/test/libyul/yulOptimizerTests/functionHoister/smoke.yul
new file mode 100644
index 00000000..35c1ce5f
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/functionHoister/smoke.yul
@@ -0,0 +1,6 @@
+{
+}
+// ----
+// functionHoister
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/mainFunction/empty_block.yul b/test/libyul/yulOptimizerTests/mainFunction/empty_block.yul
new file mode 100644
index 00000000..bae6bd48
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/mainFunction/empty_block.yul
@@ -0,0 +1,33 @@
+// yul
+{
+ let a:u256
+ { }
+ function f() -> x:bool {
+ let b:u256 := 4:u256
+ {}
+ for {} f() {} {}
+ }
+}
+// ----
+// mainFunction
+// {
+// function main()
+// {
+// let a:u256
+// {
+// }
+// }
+// function f() -> x:bool
+// {
+// let b:u256 := 4:u256
+// {
+// }
+// for {
+// }
+// f()
+// {
+// }
+// {
+// }
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/mainFunction/multi_fun_mixed.yul b/test/libyul/yulOptimizerTests/mainFunction/multi_fun_mixed.yul
new file mode 100644
index 00000000..dd5caaec
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/mainFunction/multi_fun_mixed.yul
@@ -0,0 +1,26 @@
+// yul
+{
+ let a:u256
+ function f() { let b:u256 }
+ let c:u256
+ function g() { let d:u256 }
+ let e:u256
+}
+// ----
+// mainFunction
+// {
+// function main()
+// {
+// let a:u256
+// let c:u256
+// let e:u256
+// }
+// function f()
+// {
+// let b:u256
+// }
+// function g()
+// {
+// let d:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/mainFunction/nested_fun.yul b/test/libyul/yulOptimizerTests/mainFunction/nested_fun.yul
new file mode 100644
index 00000000..309b97cc
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/mainFunction/nested_fun.yul
@@ -0,0 +1,26 @@
+// yul
+{
+ let a:u256
+ function f() {
+ let b:u256
+ function g() { let c:u256}
+ let d:u256
+ }
+}
+// ----
+// mainFunction
+// {
+// function main()
+// {
+// let a:u256
+// }
+// function f()
+// {
+// let b:u256
+// function g()
+// {
+// let c:u256
+// }
+// let d:u256
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/mainFunction/sigle_fun.yul b/test/libyul/yulOptimizerTests/mainFunction/sigle_fun.yul
new file mode 100644
index 00000000..fa9a8f41
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/mainFunction/sigle_fun.yul
@@ -0,0 +1,16 @@
+// yul
+{
+ let a:u256
+ function f() {}
+}
+// ----
+// mainFunction
+// {
+// function main()
+// {
+// let a:u256
+// }
+// function f()
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/mainFunction/smoke.yul b/test/libyul/yulOptimizerTests/mainFunction/smoke.yul
new file mode 100644
index 00000000..7be14746
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/mainFunction/smoke.yul
@@ -0,0 +1,9 @@
+// yul
+{}
+// ----
+// mainFunction
+// {
+// function main()
+// {
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/branches_for1.yul b/test/libyul/yulOptimizerTests/rematerialiser/branches_for1.yul
new file mode 100644
index 00000000..dbd1ee63
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/branches_for1.yul
@@ -0,0 +1,21 @@
+{
+ let a := 1
+ for { pop(a) } a { pop(a) } {
+ pop(a)
+ }
+}
+// ----
+// rematerialiser
+// {
+// let a := 1
+// for {
+// pop(1)
+// }
+// 1
+// {
+// pop(1)
+// }
+// {
+// pop(1)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/branches_for2.yul b/test/libyul/yulOptimizerTests/rematerialiser/branches_for2.yul
new file mode 100644
index 00000000..6a52e045
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/branches_for2.yul
@@ -0,0 +1,25 @@
+{
+ let a := 1
+ for { pop(a) } a { pop(a) } {
+ a := 7
+ let c := a
+ }
+ let x := a
+}
+// ----
+// rematerialiser
+// {
+// let a := 1
+// for {
+// pop(1)
+// }
+// a
+// {
+// pop(7)
+// }
+// {
+// a := 7
+// let c := 7
+// }
+// let x := a
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init1.yul b/test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init1.yul
new file mode 100644
index 00000000..fc816419
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init1.yul
@@ -0,0 +1,23 @@
+{
+ let b := 0
+ for { let a := 1 pop(a) } a { pop(a) } {
+ b := 1 pop(a)
+ }
+}
+// ----
+// rematerialiser
+// {
+// let b := 0
+// for {
+// let a := 1
+// pop(1)
+// }
+// 1
+// {
+// pop(1)
+// }
+// {
+// b := 1
+// pop(1)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init2.yul b/test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init2.yul
new file mode 100644
index 00000000..3d916890
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/branches_for_declared_in_init2.yul
@@ -0,0 +1,24 @@
+{
+ let b := 0
+ for { let a := 1 pop(a) } lt(a, 0) { pop(a) a := add(a, 3) } {
+ b := 1 pop(a)
+ }
+}
+// ----
+// rematerialiser
+// {
+// let b := 0
+// for {
+// let a := 1
+// pop(1)
+// }
+// lt(a, 0)
+// {
+// pop(a)
+// a := add(a, 3)
+// }
+// {
+// b := 1
+// pop(a)
+// }
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/branches_if.yul b/test/libyul/yulOptimizerTests/rematerialiser/branches_if.yul
new file mode 100644
index 00000000..c148c2f2
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/branches_if.yul
@@ -0,0 +1,18 @@
+{
+ let a := 1
+ let b := 2
+ if b { pop(b) b := a }
+ let c := b
+}
+// ----
+// rematerialiser
+// {
+// let a := 1
+// let b := 2
+// if 2
+// {
+// pop(2)
+// b := 1
+// }
+// let c := b
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/branches_switch.yul b/test/libyul/yulOptimizerTests/rematerialiser/branches_switch.yul
new file mode 100644
index 00000000..8f70a79d
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/branches_switch.yul
@@ -0,0 +1,24 @@
+{
+ let a := 1
+ let b := 2
+ switch number()
+ case 1 { b := a }
+ default { let x := a let y := b b := a }
+ pop(add(a, b))
+}
+// ----
+// rematerialiser
+// {
+// let a := 1
+// let b := 2
+// switch number()
+// case 1 {
+// b := 1
+// }
+// default {
+// let x := 1
+// let y := b
+// b := 1
+// }
+// pop(add(1, b))
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/do_not_move_out_of_scope.yul b/test/libyul/yulOptimizerTests/rematerialiser/do_not_move_out_of_scope.yul
new file mode 100644
index 00000000..891a5043
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/do_not_move_out_of_scope.yul
@@ -0,0 +1,19 @@
+// Cannot replace `let b := x` by `let b := a` since a is out of scope.
+{
+ let x
+ {
+ let a := sload(0)
+ x := a
+ }
+ let b := x
+}
+// ----
+// rematerialiser
+// {
+// let x
+// {
+// let a := sload(0)
+// x := a
+// }
+// let b := x
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code1.yul b/test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code1.yul
new file mode 100644
index 00000000..016fa0d7
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code1.yul
@@ -0,0 +1,10 @@
+{
+ let x := add(mul(calldataload(2), calldataload(4)), mul(2, calldatasize()))
+ let b := x
+}
+// ----
+// rematerialiser
+// {
+// let x := add(mul(calldataload(2), calldataload(4)), mul(2, calldatasize()))
+// let b := x
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code2.yul b/test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code2.yul
new file mode 100644
index 00000000..d95dc1fc
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/do_not_remat_large_amounts_of_code2.yul
@@ -0,0 +1,10 @@
+{
+ let x := add(mul(calldataload(2), calldataload(4)), calldatasize())
+ let b := x
+}
+// ----
+// rematerialiser
+// {
+// let x := add(mul(calldataload(2), calldataload(4)), calldatasize())
+// let b := add(mul(calldataload(2), calldataload(4)), calldatasize())
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/expression.yul b/test/libyul/yulOptimizerTests/rematerialiser/expression.yul
new file mode 100644
index 00000000..a801677d
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/expression.yul
@@ -0,0 +1,10 @@
+{
+ let a := add(mul(calldatasize(), 2), number())
+ let b := add(a, a)
+}
+// ----
+// rematerialiser
+// {
+// let a := add(mul(calldatasize(), 2), number())
+// let b := add(add(mul(calldatasize(), 2), number()), add(mul(calldatasize(), 2), number()))
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/non_movable_function.yul b/test/libyul/yulOptimizerTests/rematerialiser/non_movable_function.yul
new file mode 100644
index 00000000..9a041dfc
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/non_movable_function.yul
@@ -0,0 +1,18 @@
+{
+ function f(x) -> y {}
+ let a := 1
+ let b := f(a)
+ let c := a
+ mstore(add(a, b), c)
+}
+// ----
+// rematerialiser
+// {
+// function f(x) -> y
+// {
+// }
+// let a := 1
+// let b := f(1)
+// let c := 1
+// mstore(add(1, b), 1)
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/non_movable_instruction.yul b/test/libyul/yulOptimizerTests/rematerialiser/non_movable_instruction.yul
new file mode 100644
index 00000000..8767abc9
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/non_movable_instruction.yul
@@ -0,0 +1,14 @@
+{
+ let a := 1
+ let b := mload(a)
+ let c := a
+ mstore(add(a, b), c)
+}
+// ----
+// rematerialiser
+// {
+// let a := 1
+// let b := mload(1)
+// let c := 1
+// mstore(add(1, b), 1)
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/reassign.yul b/test/libyul/yulOptimizerTests/rematerialiser/reassign.yul
new file mode 100644
index 00000000..47124658
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/reassign.yul
@@ -0,0 +1,21 @@
+{
+ let a := extcodesize(0)
+ let b := a
+ let c := b
+ a := 2
+ let d := add(b, c)
+ pop(a) pop(b) pop(c) pop(d)
+}
+// ----
+// rematerialiser
+// {
+// let a := extcodesize(0)
+// let b := a
+// let c := a
+// a := 2
+// let d := add(b, c)
+// pop(2)
+// pop(b)
+// pop(c)
+// pop(add(b, c))
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/reassignment.yul b/test/libyul/yulOptimizerTests/rematerialiser/reassignment.yul
new file mode 100644
index 00000000..13238780
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/reassignment.yul
@@ -0,0 +1,19 @@
+{
+ let a := 1
+ pop(a)
+ if a { a := 2 }
+ let b := mload(a)
+ pop(b)
+}
+// ----
+// rematerialiser
+// {
+// let a := 1
+// pop(1)
+// if 1
+// {
+// a := 2
+// }
+// let b := mload(a)
+// pop(b)
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/smoke.yul b/test/libyul/yulOptimizerTests/rematerialiser/smoke.yul
new file mode 100644
index 00000000..2423db32
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/smoke.yul
@@ -0,0 +1,5 @@
+{}
+// ----
+// rematerialiser
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/trivial.yul b/test/libyul/yulOptimizerTests/rematerialiser/trivial.yul
new file mode 100644
index 00000000..d29ea98a
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/trivial.yul
@@ -0,0 +1,12 @@
+{
+ let a := 1
+ let b := a
+ mstore(0, b)
+}
+// ----
+// rematerialiser
+// {
+// let a := 1
+// let b := 1
+// mstore(0, 1)
+// }
diff --git a/test/libyul/yulOptimizerTests/rematerialiser/update_asignment_remat.yul b/test/libyul/yulOptimizerTests/rematerialiser/update_asignment_remat.yul
new file mode 100644
index 00000000..7d35fee0
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/rematerialiser/update_asignment_remat.yul
@@ -0,0 +1,13 @@
+// We cannot substitute `a` in `let b := a`
+{
+ let a := extcodesize(0)
+ a := mul(a, 2)
+ let b := a
+}
+// ----
+// rematerialiser
+// {
+// let a := extcodesize(0)
+// a := mul(a, 2)
+// let b := a
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/functions.yul b/test/libyul/yulOptimizerTests/unusedPruner/functions.yul
new file mode 100644
index 00000000..ec9cdda8
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/functions.yul
@@ -0,0 +1,8 @@
+{
+ function f() { let a := 1 }
+ function g() { f() }
+}
+// ----
+// unusedPruner
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/intermediate_assignment.yul b/test/libyul/yulOptimizerTests/unusedPruner/intermediate_assignment.yul
new file mode 100644
index 00000000..4ed6dd2c
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/intermediate_assignment.yul
@@ -0,0 +1,11 @@
+{
+ let a := 1
+ a := 4
+ let b := 1
+}
+// ----
+// unusedPruner
+// {
+// let a := 1
+// a := 4
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/intermediate_multi_assignment.yul b/test/libyul/yulOptimizerTests/unusedPruner/intermediate_multi_assignment.yul
new file mode 100644
index 00000000..94d101e9
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/intermediate_multi_assignment.yul
@@ -0,0 +1,16 @@
+{
+ let a, b
+ function f() -> x { }
+ a := f()
+ b := 1
+}
+// ----
+// unusedPruner
+// {
+// let a, b
+// function f() -> x
+// {
+// }
+// a := f()
+// b := 1
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/multi_assign.yul b/test/libyul/yulOptimizerTests/unusedPruner/multi_assign.yul
new file mode 100644
index 00000000..a14dc28c
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/multi_assign.yul
@@ -0,0 +1,16 @@
+{
+ let a
+ let b
+ function f() -> x, y { }
+ a, b := f()
+}
+// ----
+// unusedPruner
+// {
+// let a
+// let b
+// function f() -> x, y
+// {
+// }
+// a, b := f()
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/multi_assignments.yul b/test/libyul/yulOptimizerTests/unusedPruner/multi_assignments.yul
new file mode 100644
index 00000000..fe94edb8
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/multi_assignments.yul
@@ -0,0 +1,12 @@
+{
+ let x, y
+ x := 1
+ y := 2
+}
+// ----
+// unusedPruner
+// {
+// let x, y
+// x := 1
+// y := 2
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/multi_declarations.yul b/test/libyul/yulOptimizerTests/unusedPruner/multi_declarations.yul
new file mode 100644
index 00000000..3cf35007
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/multi_declarations.yul
@@ -0,0 +1,7 @@
+{
+ let x, y
+}
+// ----
+// unusedPruner
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/multi_declare.yul b/test/libyul/yulOptimizerTests/unusedPruner/multi_declare.yul
new file mode 100644
index 00000000..adabac87
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/multi_declare.yul
@@ -0,0 +1,12 @@
+{
+ function f() -> x, y { }
+ let a, b := f()
+}
+// ----
+// unusedPruner
+// {
+// function f() -> x, y
+// {
+// }
+// let a, b := f()
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/multi_partial_assignments.yul b/test/libyul/yulOptimizerTests/unusedPruner/multi_partial_assignments.yul
new file mode 100644
index 00000000..5db0ade9
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/multi_partial_assignments.yul
@@ -0,0 +1,10 @@
+{
+ let x, y
+ x := 1
+}
+// ----
+// unusedPruner
+// {
+// let x, y
+// x := 1
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/smoke.yul b/test/libyul/yulOptimizerTests/unusedPruner/smoke.yul
new file mode 100644
index 00000000..ca2ed942
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/smoke.yul
@@ -0,0 +1,5 @@
+{ }
+// ----
+// unusedPruner
+// {
+// }
diff --git a/test/libyul/yulOptimizerTests/unusedPruner/trivial.yul b/test/libyul/yulOptimizerTests/unusedPruner/trivial.yul
new file mode 100644
index 00000000..9b4cf9fd
--- /dev/null
+++ b/test/libyul/yulOptimizerTests/unusedPruner/trivial.yul
@@ -0,0 +1,10 @@
+{
+ let a := 1
+ let b := 1
+ mstore(0, 1)
+}
+// ----
+// unusedPruner
+// {
+// mstore(0, 1)
+// }