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 authored and chriseth committed Jan 3, 2022
1 parent b354c81 commit a88709c
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ contract DepositContract is IDepositContract, ERC165 {
// compileViaYul: also
// ----
// constructor()
// gas irOptimized: 1558001
// gas irOptimized: 1557137
// gas legacy: 2436584
// gas legacyOptimized: 1776483
// supportsInterface(bytes4): 0x0 -> 0
Expand Down
25 changes: 25 additions & 0 deletions test/libyul/yulOptimizerTests/equalStoreEliminator/branching.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
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)
}
// ====
// EVMVersion: >=byzantium
// ----
// 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 a88709c

Please sign in to comment.