diff --git a/libyul/optimiser/UnusedStoreBase.cpp b/libyul/optimiser/UnusedStoreBase.cpp index 73f957ecc4ed..8e34d172f4bf 100644 --- a/libyul/optimiser/UnusedStoreBase.cpp +++ b/libyul/optimiser/UnusedStoreBase.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include diff --git a/test/libyul/yulOptimizerTests/equalStoreEliminator/branching.yul b/test/libyul/yulOptimizerTests/equalStoreEliminator/branching.yul new file mode 100644 index 000000000000..42006450c6e6 --- /dev/null +++ b/test/libyul/yulOptimizerTests/equalStoreEliminator/branching.yul @@ -0,0 +1,23 @@ +{ + let a := calldataload(0) + let b := 20 + sstore(a, b) + if calldataload(32) { + sstore(a, b) + pop(staticcall(0, 0, 0, 0, 0, 0)) + sstore(a, b) + } + sstore(a, b) +} +// ---- +// step: equalStoreEliminator +// +// { +// let a := calldataload(0) +// let b := 20 +// sstore(a, b) +// if calldataload(32) +// { +// pop(staticcall(0, 0, 0, 0, 0, 0)) +// } +// } diff --git a/test/libyul/yulOptimizerTests/equalStoreEliminator/indirect_inferrence.yul b/test/libyul/yulOptimizerTests/equalStoreEliminator/indirect_inferrence.yul new file mode 100644 index 000000000000..114db1594ab5 --- /dev/null +++ b/test/libyul/yulOptimizerTests/equalStoreEliminator/indirect_inferrence.yul @@ -0,0 +1,22 @@ +{ + let x := calldataload(0) + let y := sload(x) + // both of these can be removed + sstore(x, y) + sstore(x, y) + + let a := x + let b := mload(a) + // both of these can be removed + mstore(a, b) + mstore(a, b) +} +// ---- +// step: equalStoreEliminator +// +// { +// let x := calldataload(0) +// let y := sload(x) +// let a := x +// let b := mload(a) +// } diff --git a/test/libyul/yulOptimizerTests/equalStoreEliminator/value_change.yul b/test/libyul/yulOptimizerTests/equalStoreEliminator/value_change.yul new file mode 100644 index 000000000000..bd1e08bcd7d4 --- /dev/null +++ b/test/libyul/yulOptimizerTests/equalStoreEliminator/value_change.yul @@ -0,0 +1,18 @@ +{ + let x := calldataload(0) + let y := calldataload(32) + sstore(x, y) + y := calldataload(64) + // cannot be removed + sstore(x, y) +} +// ---- +// step: equalStoreEliminator +// +// { +// let x := calldataload(0) +// let y := calldataload(32) +// sstore(x, y) +// y := calldataload(64) +// sstore(x, y) +// } diff --git a/test/yulPhaser/Chromosome.cpp b/test/yulPhaser/Chromosome.cpp index d3e31b5e815a..1b1e8bed5b4c 100644 --- a/test/yulPhaser/Chromosome.cpp +++ b/test/yulPhaser/Chromosome.cpp @@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE(output_operator_should_create_concise_and_unambiguous_strin BOOST_TEST(chromosome.length() == allSteps.size()); BOOST_TEST(chromosome.optimisationSteps() == allSteps); - BOOST_TEST(toString(chromosome) == "flcCUnDEvejsxIOoighFTLMRrmVatpud"); + BOOST_TEST(toString(chromosome) == "flcCUnDEvejsxIOoighFTLMRmVatrpud"); } BOOST_AUTO_TEST_CASE(optimisationSteps_should_translate_chromosomes_genes_to_optimisation_step_names)