diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 492d434c8..6d7b97cc4 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -411,14 +411,11 @@ map const& Assembly::optimiseInternal( if (m_tagReplacements) return *m_tagReplacements; - assertThrow(_settings.isCreation == m_creation, OptimizerException, "Mismatching creation settings."); - // Run optimisation for sub-assemblies. for (size_t subId = 0; subId < m_subs.size(); ++subId) { OptimiserSettings settings = _settings; Assembly& sub = *m_subs[subId]; - settings.isCreation = sub.isCreation(); map const& subTagReplacements = sub.optimiseInternal( settings, JumpdestRemover::referencedTags(m_items, subId) @@ -438,7 +435,7 @@ map const& Assembly::optimiseInternal( m_items, _tagsReferencedFromOutside, _settings.expectedExecutionsPerDeployment, - _settings.isCreation, + isCreation(), _settings.evmVersion }.optimise(); @@ -539,8 +536,8 @@ map const& Assembly::optimiseInternal( if (_settings.runConstantOptimiser) ConstantOptimisationMethod::optimiseConstants( - _settings.isCreation, - _settings.isCreation ? 1 : _settings.expectedExecutionsPerDeployment, + isCreation(), + isCreation() ? 1 : _settings.expectedExecutionsPerDeployment, _settings.evmVersion, *this ); diff --git a/libevmasm/Assembly.h b/libevmasm/Assembly.h index 270d85480..11bc16662 100644 --- a/libevmasm/Assembly.h +++ b/libevmasm/Assembly.h @@ -117,7 +117,6 @@ public: struct OptimiserSettings { - bool isCreation = false; bool runInliner = false; bool runJumpdestRemover = false; bool runPeephole = false; diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index 700f53d1f..a01dafc91 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -572,8 +572,7 @@ void CompilerContext::updateSourceLocation() evmasm::Assembly::OptimiserSettings CompilerContext::translateOptimiserSettings(OptimiserSettings const& _settings) { // Constructing it this way so that we notice changes in the fields. - evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, false, m_evmVersion, 0}; - asmSettings.isCreation = true; + evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, m_evmVersion, 0}; asmSettings.runInliner = _settings.runInliner; asmSettings.runJumpdestRemover = _settings.runJumpdestRemover; asmSettings.runPeephole = _settings.runPeephole; diff --git a/libyul/AssemblyStack.cpp b/libyul/AssemblyStack.cpp index 5d0ddd81a..3fefb9caf 100644 --- a/libyul/AssemblyStack.cpp +++ b/libyul/AssemblyStack.cpp @@ -72,8 +72,7 @@ evmasm::Assembly::OptimiserSettings translateOptimiserSettings( ) { // Constructing it this way so that we notice changes in the fields. - evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, false, _evmVersion, 0}; - asmSettings.isCreation = true; + evmasm::Assembly::OptimiserSettings asmSettings{false, false, false, false, false, false, _evmVersion, 0}; asmSettings.runInliner = _settings.runInliner; asmSettings.runJumpdestRemover = _settings.runJumpdestRemover; asmSettings.runPeephole = _settings.runPeephole; diff --git a/test/libevmasm/Optimiser.cpp b/test/libevmasm/Optimiser.cpp index 278a7c77f..44fbde927 100644 --- a/test/libevmasm/Optimiser.cpp +++ b/test/libevmasm/Optimiser.cpp @@ -1278,7 +1278,6 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies) main.append(u256(8)); Assembly::OptimiserSettings settings; - settings.isCreation = false; settings.runInliner = false; settings.runJumpdestRemover = true; settings.runPeephole = true; @@ -1287,7 +1286,7 @@ BOOST_AUTO_TEST_CASE(jumpdest_removal_subassemblies) settings.runConstantOptimiser = true; settings.evmVersion = solidity::test::CommonOptions::get().evmVersion(); settings.expectedExecutionsPerDeployment = OptimiserSettings{}.expectedExecutionsPerDeployment; -; + main.optimise(settings); AssemblyItems expectationMain{