Added MemoryStoreRemover to the optimizer suite.

However it is not part of fullsuite, and therefore disabled by default.
This commit is contained in:
hrkrshnn 2021-03-30 09:52:46 +02:00
parent f6a82f8efa
commit 6763a6bafe
3 changed files with 10 additions and 5 deletions

View File

@ -1134,6 +1134,7 @@ Abbreviation Full name
``L`` ``LoadResolver``
``M`` ``LoopInvariantCodeMotion``
``r`` ``RedundantAssignEliminator``
``S`` ``MemoryStoreRemover`` - highly experimental
``R`` ``ReasoningBasedSimplifier`` - highly experimental
``m`` ``Rematerialiser``
``V`` ``SSAReverser``
@ -1146,10 +1147,11 @@ Abbreviation Full name
Some steps depend on properties ensured by ``BlockFlattener``, ``FunctionGrouper``, ``ForLoopInitRewriter``.
For this reason the Yul optimizer always applies them before applying any steps supplied by the user.
The ReasoningBasedSimplifier is an optimizer step that is currently not enabled
in the default set of steps. It uses an SMT solver to simplify arithmetic expressions
and boolean conditions. It has not received thorough testing or validation yet and can produce
non-reproducible results, so please use with care!
The ReasoningBasedSimplifier and MemoryStoreRemover are optimizer steps that are currently not
enabled in the default set of steps. ReasoningBasedSimplifier uses an SMT solver to simplify
arithmetic expressions and boolean conditions. Similarly, MemoryStoreRemover uses an SMT solver to
remove memory stores that are never read. They have not received thorough testing or validation yet
and can produce non-reproducible results, so please use with care!
.. _erc20yul:

View File

@ -42,6 +42,7 @@
#include <libyul/optimiser/ForLoopInitRewriter.h>
#include <libyul/optimiser/ForLoopConditionIntoBody.h>
#include <libyul/optimiser/FunctionSpecializer.h>
#include <libyul/optimiser/MemoryStoreRemover.h>
#include <libyul/optimiser/ReasoningBasedSimplifier.h>
#include <libyul/optimiser/Rematerialiser.h>
#include <libyul/optimiser/UnusedFunctionParameterPruner.h>
@ -199,6 +200,7 @@ map<string, unique_ptr<OptimiserStep>> const& OptimiserSuite::allSteps()
LiteralRematerialiser,
LoadResolver,
LoopInvariantCodeMotion,
MemoryStoreRemover,
RedundantAssignEliminator,
ReasoningBasedSimplifier,
Rematerialiser,
@ -239,6 +241,7 @@ map<string, char> const& OptimiserSuite::stepNameToAbbreviationMap()
{LiteralRematerialiser::name, 'T'},
{LoadResolver::name, 'L'},
{LoopInvariantCodeMotion::name, 'M'},
{MemoryStoreRemover::name, 'S'},
{ReasoningBasedSimplifier::name, 'R'},
{RedundantAssignEliminator::name, 'r'},
{Rematerialiser::name, 'm'},

View File

@ -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) == "flcCUnDvejsxIOoighFTLMRrmVatpud");
BOOST_TEST(toString(chromosome) == "flcCUnDvejsxIOoighFTLMSRrmVatpud");
}
BOOST_AUTO_TEST_CASE(optimisationSteps_should_translate_chromosomes_genes_to_optimisation_step_names)