Skip to content

Commit

Permalink
Added more tests. Updated chromosome. Remove unused header
Browse files Browse the repository at this point in the history
  • Loading branch information
hrkrshnn committed Jan 3, 2022
1 parent 4330695 commit 3c64328
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 2 deletions.
1 change: 0 additions & 1 deletion libyul/optimiser/UnusedStoreBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <libyul/optimiser/Semantics.h>
#include <libyul/optimiser/OptimiserStep.h>
#include <libyul/optimiser/OptimizerUtilities.h>
#include <libyul/AST.h>

#include <libsolutil/CommonData.h>
Expand Down
23 changes: 23 additions & 0 deletions test/libyul/yulOptimizerTests/equalStoreEliminator/branching.yul
Original file line number Diff line number Diff line change
@@ -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))
// }
// }
Original file line number Diff line number Diff line change
@@ -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)
// }
Original file line number Diff line number Diff line change
@@ -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)
// }
2 changes: 1 addition & 1 deletion test/yulPhaser/Chromosome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3c64328

Please sign in to comment.