From f0fb046038c5d4d45d544181ebf03a196424fe28 Mon Sep 17 00:00:00 2001 From: cameel Date: Wed, 29 Jan 2020 20:00:16 +0100 Subject: [PATCH] [yul-phaser] Remove Chromosome::allStepNamesExcept() --- tools/yulPhaser/Chromosome.cpp | 44 +--------------------------------- tools/yulPhaser/Chromosome.h | 3 --- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/tools/yulPhaser/Chromosome.cpp b/tools/yulPhaser/Chromosome.cpp index 6e887bd11..b332266ba 100644 --- a/tools/yulPhaser/Chromosome.cpp +++ b/tools/yulPhaser/Chromosome.cpp @@ -26,7 +26,6 @@ using namespace std; using namespace solidity; -using namespace solidity::util; using namespace solidity::yul; using namespace solidity::phaser; @@ -63,50 +62,9 @@ vector Chromosome::allStepNames() return stepNames; } -vector Chromosome::allStepNamesExcept(vector const& _excludedStepNames) -{ - // This is not very efficient but vectors are small and the caller will cache the results anyway. - // What matters a bit more is that using vector rather than a set gives us O(1) access to - // random elements in other functions. - return convertContainer>( - convertContainer>(allStepNames()) - - convertContainer>(_excludedStepNames) - ); -} - string const& Chromosome::randomOptimisationStep() { - static vector stepNames = allStepNamesExcept({ - // All possible steps, listed and commented-out for easy tweaking. - // The uncommented ones are not used (possibly because they fail). - //{BlockFlattener::name}, - //{CommonSubexpressionEliminator::name}, - //{ConditionalSimplifier::name}, - //{ConditionalUnsimplifier::name}, - //{ControlFlowSimplifier::name}, - //{DeadCodeEliminator::name}, - //{EquivalentFunctionCombiner::name}, - //{ExpressionInliner::name}, - //{ExpressionJoiner::name}, - //{ExpressionSimplifier::name}, - //{ExpressionSplitter::name}, - //{ForLoopConditionIntoBody::name}, - //{ForLoopConditionOutOfBody::name}, - //{ForLoopInitRewriter::name}, - //{FullInliner::name}, - //{FunctionGrouper::name}, - //{FunctionHoister::name}, - //{LiteralRematerialiser::name}, - //{LoadResolver::name}, - //{LoopInvariantCodeMotion::name}, - //{RedundantAssignEliminator::name}, - //{Rematerialiser::name}, - //{SSAReverser::name}, - //{SSATransform::name}, - //{StructuralSimplifier::name}, - //{UnusedPruner::name}, - //{VarDeclInitializer::name}, - }); + static vector stepNames = allStepNames(); return stepNames[uniformRandomInt(0, stepNames.size() - 1)]; } diff --git a/tools/yulPhaser/Chromosome.h b/tools/yulPhaser/Chromosome.h index 84b33d356..6db99dc4e 100644 --- a/tools/yulPhaser/Chromosome.h +++ b/tools/yulPhaser/Chromosome.h @@ -54,9 +54,6 @@ public: private: static std::vector allStepNames(); - static std::vector allStepNamesExcept( - std::vector const& _excludedStepNames - ); static std::string const& randomOptimisationStep(); std::vector m_optimisationSteps;