NameSimplifier is removed from steps available to users.

This commit is contained in:
hrkrshnn 2020-11-30 12:50:02 +01:00
parent 5a15a4a6bd
commit 3efac3eef0
3 changed files with 8 additions and 5 deletions

View File

@ -32,7 +32,7 @@ namespace solidity::frontend
struct OptimiserSettings
{
static char constexpr DefaultYulOptimiserSteps[] =
"NdhfoDgvulfnTUtnIf" // None of these can make stack problems worse
"dhfoDgvulfnTUtnIf" // None of these can make stack problems worse
"["
"xarrscLM" // Turn into SSA and simplify
"cCTUtTOntnfDIul" // Perform structural simplification
@ -47,7 +47,7 @@ struct OptimiserSettings
"gvif" // Run full inliner
"CTUcarrLsTOtfDncarrIulc" // SSA plus simplify
"]"
"jmuljuljul VcTOcul jmulN"; // Make source short and pretty
"jmuljuljul VcTOcul jmul"; // Make source short and pretty
/// No optimisations at all - not recommended.
static OptimiserSettings none()

View File

@ -105,6 +105,7 @@ void OptimiserSuite::run(
// ForLoopInitRewriter. Run them first to be able to run arbitrary sequences safely.
suite.runSequence("hfgo", ast);
NameSimplifier::run(suite.m_context, ast);
// Now the user-supplied part
suite.runSequence(_optimisationSequence, ast);
@ -140,6 +141,9 @@ void OptimiserSuite::run(
if (ast.statements.size() > 1 && std::get<Block>(ast.statements.front()).statements.empty())
ast.statements.erase(ast.statements.begin());
}
suite.m_dispenser.reset(ast);
NameSimplifier::run(suite.m_context, ast);
VarNameCleaner::run(suite.m_context, ast);
*_object.analysisInfo = AsmAnalyzer::analyzeStrictAssertCorrect(_dialect, _object);
@ -191,7 +195,6 @@ map<string, unique_ptr<OptimiserStep>> const& OptimiserSuite::allSteps()
LiteralRematerialiser,
LoadResolver,
LoopInvariantCodeMotion,
NameSimplifier,
RedundantAssignEliminator,
ReasoningBasedSimplifier,
Rematerialiser,
@ -203,6 +206,7 @@ map<string, unique_ptr<OptimiserStep>> const& OptimiserSuite::allSteps()
VarDeclInitializer
>();
// Does not include VarNameCleaner because it destroys the property of unique names.
// Does not include NameSimplifier.
return instance;
}
@ -230,7 +234,6 @@ map<string, char> const& OptimiserSuite::stepNameToAbbreviationMap()
{LiteralRematerialiser::name, 'T'},
{LoadResolver::name, 'L'},
{LoopInvariantCodeMotion::name, 'M'},
{NameSimplifier::name, 'N'},
{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) == "flcCUnDvejsxIOoighTLMNRrmVatpud");
BOOST_TEST(toString(chromosome) == "flcCUnDvejsxIOoighTLMRrmVatpud");
}
BOOST_AUTO_TEST_CASE(optimisationSteps_should_translate_chromosomes_genes_to_optimisation_step_names)