diff --git a/libyul/backends/evm/ControlFlowGraph.h b/libyul/backends/evm/ControlFlowGraph.h index 46224edae..48172e5d8 100644 --- a/libyul/backends/evm/ControlFlowGraph.h +++ b/libyul/backends/evm/ControlFlowGraph.h @@ -24,7 +24,8 @@ #include #include #include -#include + +#include #include #include @@ -51,10 +52,10 @@ struct FunctionReturnLabelSlot /// A slot containing the current value of a particular variable. struct VariableSlot { - std::reference_wrapper variable; + YulString variable; std::shared_ptr debugData{}; - bool operator==(VariableSlot const& _rhs) const { return &variable.get() == &_rhs.variable.get(); } - bool operator<(VariableSlot const& _rhs) const { return &variable.get() < &_rhs.variable.get(); } + bool operator==(VariableSlot const& _rhs) const { return variable == _rhs.variable; } + bool operator<(VariableSlot const& _rhs) const { return variable < _rhs.variable; } static constexpr bool canBeFreelyGenerated = false; }; /// A slot containing a literal value. @@ -66,18 +67,6 @@ struct LiteralSlot bool operator<(LiteralSlot const& _rhs) const { return value < _rhs.value; } static constexpr bool canBeFreelyGenerated = true; }; -/// A slot containing the idx-th return value of a previous call. -struct TemporarySlot -{ - /// The call that returned this slot. - std::reference_wrapper call; - /// Specifies to which of the values returned by the call this slot refers. - /// index == 0 refers to the slot deepest in the stack after the call. - size_t index = 0; - bool operator==(TemporarySlot const& _rhs) const { return &call.get() == &_rhs.call.get() && index == _rhs.index; } - bool operator<(TemporarySlot const& _rhs) const { return std::make_pair(&call.get(), index) < std::make_pair(&_rhs.call.get(), _rhs.index); } - static constexpr bool canBeFreelyGenerated = false; -}; /// A slot containing an arbitrary value that is always eventually popped and never used. /// Used to maintain stack balance on control flow joins. struct JunkSlot @@ -86,7 +75,7 @@ struct JunkSlot bool operator<(JunkSlot const&) const { return false; } static constexpr bool canBeFreelyGenerated = true; }; -using StackSlot = std::variant; +using StackSlot = std::variant; /// The stack top is usually the last element of the vector. using Stack = std::vector; @@ -116,15 +105,12 @@ struct CFG struct FunctionCall { std::shared_ptr debugData; - std::reference_wrapper function; std::reference_wrapper functionCall; + std::reference_wrapper referencedFunction; }; struct Assignment { std::shared_ptr debugData; - /// The variables being assigned to also occur as ``output`` in the ``Operation`` containing - /// the assignment, but are also stored here for convenience. - std::vector variables; }; struct Operation @@ -164,25 +150,21 @@ struct CFG struct FunctionInfo { std::shared_ptr debugData; - Scope::Function const& function; + yul::FunctionDefinition const* function = nullptr; BasicBlock* entry = nullptr; - std::vector parameters; - std::vector returnVariables; }; /// The main entry point, i.e. the start of the outermost Yul block. BasicBlock* entry = nullptr; /// Subgraphs for functions. - std::map functionInfo; + std::map functionInfo; /// List of functions in order of declaration. - std::list functions; + std::list functions; /// Container for blocks for explicit ownership. std::list blocks; - /// Container for creates variables for explicit ownership. - std::list ghostVariables; - /// Container for creates calls for explicit ownership. - std::list ghostCalls; + /// Container for created variables for explicit ownership. + std::list ghostVariable; BasicBlock& makeBlock() { diff --git a/libyul/backends/evm/ControlFlowGraphBuilder.cpp b/libyul/backends/evm/ControlFlowGraphBuilder.cpp index eaad98cb4..51c174cd4 100644 --- a/libyul/backends/evm/ControlFlowGraphBuilder.cpp +++ b/libyul/backends/evm/ControlFlowGraphBuilder.cpp @@ -25,12 +25,16 @@ #include #include +#include + #include -#include #include +#include +#include #include #include +#include #include #include #include @@ -47,6 +51,26 @@ using namespace solidity; using namespace solidity::yul; using namespace std; +namespace +{ +template +void forEachExit(Block&& _block, Callable _callable) +{ + std::visit(util::GenericVisitor{ + [&](CFG::BasicBlock::Jump& _jump) { + _callable(_jump.target); + }, + [&](CFG::BasicBlock::ConditionalJump& _jump) { + _callable(_jump.zero); + _callable(_jump.nonZero); + }, + [](CFG::BasicBlock::FunctionReturn&) {}, + [](CFG::BasicBlock::Terminated&) {}, + [](CFG::BasicBlock::MainExit&) {} + }, _block.exit); +} +} + std::unique_ptr ControlFlowGraphBuilder::build( AsmAnalysisInfo& _analysisInfo, Dialect const& _dialect, @@ -56,39 +80,75 @@ std::unique_ptr ControlFlowGraphBuilder::build( auto result = std::make_unique(); result->entry = &result->makeBlock(); - ControlFlowGraphBuilder builder(*result, _analysisInfo, _dialect); + auto functionDefinitions = FunctionDefinitionCollector::run(_block); + + ControlFlowGraphBuilder builder(*result, _analysisInfo, _dialect, functionDefinitions); builder.m_currentBlock = result->entry; builder(_block); - // Determine which blocks are reachable from the entry. - util::BreadthFirstSearch reachabilityCheck{{result->entry}}; + list allEntries{result->entry}; ranges::actions::push_back( - reachabilityCheck.verticesToTraverse, + allEntries, result->functionInfo | ranges::views::values | ranges::views::transform( [](auto&& _function) { return _function.entry; } ) ); - reachabilityCheck.run([&](CFG::BasicBlock* _node, auto&& _addChild) { - visit(util::GenericVisitor{ - [&](CFG::BasicBlock::Jump& _jump) { - _addChild(_jump.target); - }, - [&](CFG::BasicBlock::ConditionalJump& _jump) { - _addChild(_jump.zero); - _addChild(_jump.nonZero); - }, - [](CFG::BasicBlock::FunctionReturn&) {}, - [](CFG::BasicBlock::Terminated&) {}, - [](CFG::BasicBlock::MainExit&) {} - }, _node->exit); - }); - - // Remove all entries from unreachable nodes from the graph. - for (auto* node: reachabilityCheck.visited) - cxx20::erase_if(node->entries, [&](CFG::BasicBlock* entry) -> bool { - return !reachabilityCheck.visited.count(entry); + { + // Determine which blocks are reachable from the entry. + util::BreadthFirstSearch reachabilityCheck{allEntries}; + reachabilityCheck.run([&](CFG::BasicBlock* _node, auto&& _addChild) { + visit(util::GenericVisitor{ + [&](CFG::BasicBlock::Jump& _jump) { + _addChild(_jump.target); + }, + [&](CFG::BasicBlock::ConditionalJump& _jump) { + _addChild(_jump.zero); + _addChild(_jump.nonZero); + }, + [](CFG::BasicBlock::FunctionReturn&) {}, + [](CFG::BasicBlock::Terminated&) {}, + [](CFG::BasicBlock::MainExit&) {} + }, _node->exit); }); + // Remove all entries from unreachable nodes from the graph. + for (auto* node: reachabilityCheck.visited) + cxx20::erase_if(node->entries, [&](CFG::BasicBlock* entry) -> bool { + return !reachabilityCheck.visited.count(entry); + }); + } + { + // Merge any block with only one entry forward-jumping to it with its entry. + util::BreadthFirstSearch reachabilityCheck{allEntries}; + reachabilityCheck.run([&](CFG::BasicBlock* _node, auto&& _addChild) { + if (CFG::BasicBlock* _entry = (_node->entries.size() == 1) ? _node->entries.front() : nullptr) + if (CFG::BasicBlock::Jump* jump = get_if(&_entry->exit)) + if (!jump->backwards) + { + _entry->operations += std::move(_node->operations); + _node->operations.clear(); + _entry->exit = _node->exit; + forEachExit(*_node, [&](CFG::BasicBlock* _exit) { + ranges::remove(_exit->entries, _node); + _exit->entries.emplace_back(_entry); + }); + } + visit(util::GenericVisitor{ + [&](CFG::BasicBlock::Jump& _jump) { + _addChild(_jump.target); + }, + [&](CFG::BasicBlock::ConditionalJump& _jump) { + _addChild(_jump.zero); + _addChild(_jump.nonZero); + }, + [](CFG::BasicBlock::FunctionReturn&) {}, + [](CFG::BasicBlock::Terminated&) {}, + [](CFG::BasicBlock::MainExit&) {} + }, _node->exit); + }); + } + + // TODO: It might be worthwhile to run some further simplifications on the graph itself here. // E.g. if there is a jump to a node that has the jumping node as its only entry, the nodes can be fused, etc. @@ -98,11 +158,13 @@ std::unique_ptr ControlFlowGraphBuilder::build( ControlFlowGraphBuilder::ControlFlowGraphBuilder( CFG& _graph, AsmAnalysisInfo& _analysisInfo, - Dialect const& _dialect + Dialect const& _dialect, + map const& _functionDefinitions ): m_graph(_graph), m_info(_analysisInfo), -m_dialect(_dialect) +m_dialect(_dialect), +m_functionDefinitions(_functionDefinitions) { } @@ -113,7 +175,7 @@ StackSlot ControlFlowGraphBuilder::operator()(Literal const& _literal) StackSlot ControlFlowGraphBuilder::operator()(Identifier const& _identifier) { - return VariableSlot{lookupVariable(_identifier.name), _identifier.debugData}; + return VariableSlot{_identifier.name, _identifier.debugData}; } StackSlot ControlFlowGraphBuilder::operator()(Expression const& _expression) @@ -121,9 +183,8 @@ StackSlot ControlFlowGraphBuilder::operator()(Expression const& _expression) return std::visit(*this, _expression); } -CFG::Operation& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _call) +CFG::Operation& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _call, vector _outputs) { - yulAssert(m_scope, ""); yulAssert(m_currentBlock, ""); if (BuiltinFunction const* builtin = m_dialect.builtin(_call.functionName.name)) @@ -140,9 +201,7 @@ CFG::Operation& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _ ranges::views::transform(std::ref(*this)) | ranges::to, // output - ranges::views::iota(0u, builtin->returns.size()) | ranges::views::transform([&](size_t _i) { - return TemporarySlot{_call, _i}; - }) | ranges::to, + _outputs | ranges::to, // operation CFG::BuiltinCall{_call.debugData, *builtin, _call} }); @@ -151,12 +210,8 @@ CFG::Operation& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _ } else { - Scope::Function* function = nullptr; - yulAssert(m_scope->lookup(_call.functionName.name, util::GenericVisitor{ - [](Scope::Variable&) { yulAssert(false, "Expected function name."); }, - [&](Scope::Function& _function) { function = &_function; } - }), "Function name not found."); - yulAssert(function, ""); + yul::FunctionDefinition const* functionDefinition = m_functionDefinitions.at(_call.functionName.name); + yulAssert(functionDefinition, ""); return m_currentBlock->operations.emplace_back(CFG::Operation{ // input ranges::concat_view( @@ -164,41 +219,34 @@ CFG::Operation& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _ _call.arguments | ranges::views::reverse | ranges::views::transform(std::ref(*this)) ) | ranges::to, // output - ranges::views::iota(0u, function->returns.size()) | ranges::views::transform([&](size_t _i) { - return TemporarySlot{_call, _i}; - }) | ranges::to, + _outputs | ranges::to, // operation - CFG::FunctionCall{_call.debugData, *function, _call} + CFG::FunctionCall{_call.debugData, _call, *functionDefinition} }); } } -StackSlot ControlFlowGraphBuilder::operator()(FunctionCall const& _call) +StackSlot ControlFlowGraphBuilder::operator()(FunctionCall const&) { - CFG::Operation& operation = visitFunctionCall(_call); - yulAssert(operation.output.size() == 1, ""); - return operation.output.front(); + yulAssert(false, "Expected split expressions."); + return JunkSlot{}; } void ControlFlowGraphBuilder::operator()(VariableDeclaration const& _varDecl) { yulAssert(m_currentBlock, ""); auto declaredVariables = _varDecl.variables | ranges::views::transform([&](TypedName const& _var) { - return VariableSlot{lookupVariable(_var.name), _var.debugData}; + return VariableSlot{_var.name, _var.debugData}; }) | ranges::to; Stack input; if (_varDecl.value) - input = std::visit(util::GenericVisitor{ - [&](FunctionCall const& _call) -> Stack { - CFG::Operation& operation = visitFunctionCall(_call); - yulAssert(declaredVariables.size() == operation.output.size(), ""); - return operation.output; - }, - [&](auto const& _identifierOrLiteral) -> Stack{ - yulAssert(declaredVariables.size() == 1, ""); - return {(*this)(_identifierOrLiteral)}; - } - }, *_varDecl.value); + if (FunctionCall const* call = get_if(_varDecl.value.get())) + { + visitFunctionCall(*call, std::move(declaredVariables)); + return; + } + else + input = {std::visit(std::ref(*this), *_varDecl.value)}; else input = ranges::views::iota(0u, _varDecl.variables.size()) | ranges::views::transform([&](size_t) { return LiteralSlot{0, _varDecl.debugData}; @@ -206,33 +254,30 @@ void ControlFlowGraphBuilder::operator()(VariableDeclaration const& _varDecl) m_currentBlock->operations.emplace_back(CFG::Operation{ std::move(input), declaredVariables | ranges::to, - CFG::Assignment{_varDecl.debugData, declaredVariables} + CFG::Assignment{_varDecl.debugData} }); } void ControlFlowGraphBuilder::operator()(Assignment const& _assignment) { vector assignedVariables = _assignment.variableNames | ranges::views::transform([&](Identifier const& _var) { - return VariableSlot{lookupVariable(_var.name), _var.debugData}; + return VariableSlot{_var.name, _var.debugData}; }) | ranges::to>; yulAssert(m_currentBlock, ""); + if (FunctionCall const* call = get_if(_assignment.value.get())) + { + visitFunctionCall(*call, std::move(assignedVariables)); + return; + } + else + m_currentBlock->operations.emplace_back(CFG::Operation{ // input - std::visit(util::GenericVisitor{ - [&](FunctionCall const& _call) -> Stack { - CFG::Operation& operation = visitFunctionCall(_call); - yulAssert(assignedVariables.size() == operation.output.size(), ""); - return operation.output; - }, - [&](auto const& _identifierOrLiteral) -> Stack { - yulAssert(assignedVariables.size() == 1, ""); - return {(*this)(_identifierOrLiteral)}; - } - }, *_assignment.value), + {std::visit(std::ref(*this), *_assignment.value)}, // output assignedVariables | ranges::to, // operation - CFG::Assignment{_assignment.debugData, assignedVariables} + CFG::Assignment{_assignment.debugData} }); } void ControlFlowGraphBuilder::operator()(ExpressionStatement const& _exprStmt) @@ -240,7 +285,7 @@ void ControlFlowGraphBuilder::operator()(ExpressionStatement const& _exprStmt) yulAssert(m_currentBlock, ""); std::visit(util::GenericVisitor{ [&](FunctionCall const& _call) { - CFG::Operation& operation = visitFunctionCall(_call); + CFG::Operation& operation = visitFunctionCall(_call, {}); yulAssert(operation.output.empty(), ""); }, [&](auto const&) { yulAssert(false, ""); } @@ -259,7 +304,6 @@ void ControlFlowGraphBuilder::operator()(ExpressionStatement const& _exprStmt) void ControlFlowGraphBuilder::operator()(Block const& _block) { - ScopedSaveAndRestore saveScope(m_scope, m_info.scopes.at(&_block).get()); for (auto const& statement: _block.statements) std::visit(*this, statement); } @@ -304,18 +348,7 @@ void ControlFlowGraphBuilder::operator()(If const& _if) void ControlFlowGraphBuilder::operator()(Switch const& _switch) { yulAssert(m_currentBlock, ""); - auto ghostVariableId = m_graph.ghostVariables.size(); - YulString ghostVariableName("GHOST[" + to_string(ghostVariableId) + "]"); - auto& ghostVar = m_graph.ghostVariables.emplace_back(Scope::Variable{""_yulstring, ghostVariableName}); - - // Artificially generate: - // let := - VariableSlot ghostVarSlot{ghostVar, debugDataOf(*_switch.expression)}; - m_currentBlock->operations.emplace_back(CFG::Operation{ - Stack{std::visit(*this, *_switch.expression)}, - Stack{ghostVarSlot}, - CFG::Assignment{_switch.debugData, {ghostVarSlot}} - }); + StackSlot switchExpression = std::visit(std::ref(*this), *_switch.expression); BuiltinFunction const* equalityBuiltin = m_dialect.equalityFunction({}); yulAssert(equalityBuiltin, ""); @@ -323,15 +356,23 @@ void ControlFlowGraphBuilder::operator()(Switch const& _switch) // Artificially generate: // eq(, ) auto makeValueCompare = [&](Literal const& _value) { - yul::FunctionCall const& ghostCall = m_graph.ghostCalls.emplace_back(yul::FunctionCall{ + size_t ghostVariableId = m_graph.ghostVariable.size(); + // TODO: properly use NameDispenser to generate names for these. + YulString ghostVarName = YulString{"GHOST[" + to_string(ghostVariableId) + "]"}; + VariableDeclaration& ghostDecl = m_graph.ghostVariable.emplace_back(VariableDeclaration{ _value.debugData, - yul::Identifier{{}, "eq"_yulstring}, - {_value, Identifier{{}, ghostVariableName}} + {TypedName{_value.debugData, ghostVarName, {}}}, + std::make_unique(yul::FunctionCall{ + _value.debugData, + yul::Identifier{{}, "eq"_yulstring}, + {_value, *_switch.expression} + }) }); + CFG::Operation& operation = m_currentBlock->operations.emplace_back(CFG::Operation{ - Stack{ghostVarSlot, LiteralSlot{valueOfLiteral(_value), _value.debugData}}, - Stack{TemporarySlot{ghostCall, 0}}, - CFG::BuiltinCall{_switch.debugData, *equalityBuiltin, ghostCall, 2}, + Stack{switchExpression, LiteralSlot{valueOfLiteral(_value), _value.debugData}}, + Stack{VariableSlot{ghostVarName, _value.debugData}}, + CFG::BuiltinCall{_switch.debugData, *equalityBuiltin, get(*ghostDecl.value.get()), 2}, }); return operation.output.front(); }; @@ -360,7 +401,6 @@ void ControlFlowGraphBuilder::operator()(Switch const& _switch) void ControlFlowGraphBuilder::operator()(ForLoop const& _loop) { - ScopedSaveAndRestore scopeRestore(m_scope, m_info.scopes.at(&_loop.pre).get()); (*this)(_loop.pre); std::optional constantCondition; @@ -429,56 +469,18 @@ void ControlFlowGraphBuilder::operator()(Leave const&) void ControlFlowGraphBuilder::operator()(FunctionDefinition const& _function) { - yulAssert(m_scope, ""); - yulAssert(m_scope->identifiers.count(_function.name), ""); - Scope::Function& function = std::get(m_scope->identifiers.at(_function.name)); - m_graph.functions.emplace_back(&function); - - yulAssert(m_info.scopes.at(&_function.body), ""); - Scope* virtualFunctionScope = m_info.scopes.at(m_info.virtualBlocks.at(&_function).get()).get(); - yulAssert(virtualFunctionScope, ""); - - auto&& [it, inserted] = m_graph.functionInfo.emplace(std::make_pair(&function, CFG::FunctionInfo{ + m_graph.functions.emplace_back(_function.name); + auto&& [it, inserted] = m_graph.functionInfo.emplace(std::make_pair(_function.name, CFG::FunctionInfo{ _function.debugData, - function, - &m_graph.makeBlock(), - _function.parameters | ranges::views::transform([&](auto const& _param) { - return VariableSlot{ - std::get(virtualFunctionScope->identifiers.at(_param.name)), - _param.debugData - }; - }) | ranges::to, - _function.returnVariables | ranges::views::transform([&](auto const& _retVar) { - return VariableSlot{ - std::get(virtualFunctionScope->identifiers.at(_retVar.name)), - _retVar.debugData - }; - }) | ranges::to + &_function, + &m_graph.makeBlock() })); yulAssert(inserted, ""); CFG::FunctionInfo& info = it->second; - ControlFlowGraphBuilder builder{m_graph, m_info, m_dialect}; + ControlFlowGraphBuilder builder{m_graph, m_info, m_dialect, m_functionDefinitions}; builder.m_currentFunctionExit = CFG::BasicBlock::FunctionReturn{&info}; builder.m_currentBlock = info.entry; builder(_function.body); builder.m_currentBlock->exit = CFG::BasicBlock::FunctionReturn{&info}; } - -Scope::Variable const& ControlFlowGraphBuilder::lookupVariable(YulString _name) const -{ - yulAssert(m_scope, ""); - Scope::Variable *var = nullptr; - if (m_scope->lookup(_name, util::GenericVisitor{ - [&](Scope::Variable& _var) { var = &_var; }, - [](Scope::Function&) - { - yulAssert(false, "Function not removed during desugaring."); - } - })) - { - yulAssert(var, ""); - return *var; - }; - yulAssert(false, "External identifier access unimplemented."); -} diff --git a/libyul/backends/evm/ControlFlowGraphBuilder.h b/libyul/backends/evm/ControlFlowGraphBuilder.h index 7e969e7be..f3a11317d 100644 --- a/libyul/backends/evm/ControlFlowGraphBuilder.h +++ b/libyul/backends/evm/ControlFlowGraphBuilder.h @@ -55,19 +55,19 @@ private: ControlFlowGraphBuilder( CFG& _graph, AsmAnalysisInfo& _analysisInfo, - Dialect const& _dialect + Dialect const& _dialect, + std::map const& _functionDefinitions ); - CFG::Operation& visitFunctionCall(FunctionCall const&); + CFG::Operation& visitFunctionCall(FunctionCall const& _call, std::vector _outputs); - Scope::Variable const& lookupVariable(YulString _name) const; std::pair makeConditionalJump(StackSlot _condition); void makeConditionalJump(StackSlot _condition, CFG::BasicBlock& _nonZero, CFG::BasicBlock& _zero); void jump(CFG::BasicBlock& _target, bool _backwards = false); CFG& m_graph; AsmAnalysisInfo& m_info; Dialect const& m_dialect; + std::map const& m_functionDefinitions; CFG::BasicBlock* m_currentBlock = nullptr; - Scope* m_scope = nullptr; struct ForLoopInfo { std::reference_wrapper afterLoop; diff --git a/libyul/backends/evm/EVMObjectCompiler.cpp b/libyul/backends/evm/EVMObjectCompiler.cpp index eeb57a549..d34e5e47f 100644 --- a/libyul/backends/evm/EVMObjectCompiler.cpp +++ b/libyul/backends/evm/EVMObjectCompiler.cpp @@ -25,6 +25,8 @@ #include #include +#include + #include #include @@ -42,7 +44,6 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize) BuiltinContext context; context.currentObject = &_object; - for (auto const& subNode: _object.subObjects) if (auto* subObject = dynamic_cast(subNode.get())) { diff --git a/libyul/backends/evm/OptimizedEVMCodeTransform.cpp b/libyul/backends/evm/OptimizedEVMCodeTransform.cpp index 76ac8ff76..1df7e8b8f 100644 --- a/libyul/backends/evm/OptimizedEVMCodeTransform.cpp +++ b/libyul/backends/evm/OptimizedEVMCodeTransform.cpp @@ -21,6 +21,11 @@ #include #include +#include +#include +#include +#include + #include #include @@ -60,20 +65,20 @@ void OptimizedEVMCodeTransform::assertLayoutCompatibility(Stack const& _currentS yulAssert(holds_alternative(desiredSlot) || currentSlot == desiredSlot, ""); } -AbstractAssembly::LabelID OptimizedEVMCodeTransform::getFunctionLabel(Scope::Function const& _function) +AbstractAssembly::LabelID OptimizedEVMCodeTransform::getFunctionLabel(YulString _functionName) { - CFG::FunctionInfo const& functionInfo = m_dfg.functionInfo.at(&_function); - if (!m_functionLabels.count(&functionInfo)) + CFG::FunctionInfo const& functionInfo = m_dfg.functionInfo.at(_functionName); + if (!m_functionLabels.count(_functionName)) { - m_functionLabels[&functionInfo] = m_useNamedLabelsForFunctions ? + m_functionLabels[_functionName] = m_useNamedLabelsForFunctions ? m_assembly.namedLabel( - functionInfo.function.name.str(), - functionInfo.function.arguments.size(), - functionInfo.function.returns.size(), + functionInfo.function->name.str(), + functionInfo.function->parameters.size(), + functionInfo.function->returnVariables.size(), {} ) : m_assembly.newLabelId(); } - return m_functionLabels[&functionInfo]; + return m_functionLabels[_functionName]; } void OptimizedEVMCodeTransform::validateSlot(StackSlot const& _slot, Expression const& _expression) @@ -85,11 +90,10 @@ void OptimizedEVMCodeTransform::validateSlot(StackSlot const& _slot, Expression }, [&](yul::Identifier const& _identifier) { auto* variableSlot = get_if(&_slot); - yulAssert(variableSlot && variableSlot->variable.get().name == _identifier.name, ""); + yulAssert(variableSlot && variableSlot->variable == _identifier.name, ""); }, - [&](yul::FunctionCall const& _call) { - auto* temporarySlot = get_if(&_slot); - yulAssert(temporarySlot && &temporarySlot->call.get() == &_call, ""); + [&](yul::FunctionCall const&) { + yulAssert(false, "Expected split expressions."); } }, _expression); } @@ -103,14 +107,11 @@ void OptimizedEVMCodeTransform::operator()(CFG::FunctionInfo const& _functionInf m_stack.clear(); m_stack.emplace_back(FunctionReturnLabelSlot{}); - for (auto const& param: _functionInfo.parameters | ranges::views::reverse) - m_stack.emplace_back(param); + for (auto const& param: _functionInfo.function->parameters | ranges::views::reverse) + m_stack.emplace_back(VariableSlot{param.name, param.debugData}); m_assembly.setStackHeight(static_cast(m_stack.size())); m_assembly.setSourceLocation(locationOf(_functionInfo)); - if (!m_functionLabels.count(&_functionInfo)) - m_functionLabels[&_functionInfo] = m_assembly.newLabelId(); - - m_assembly.appendLabel(getFunctionLabel(_functionInfo.function)); + m_assembly.appendLabel(getFunctionLabel(_functionInfo.function->name)); createStackLayout(entryLayout); (*this)(*_functionInfo.entry); @@ -122,7 +123,7 @@ void OptimizedEVMCodeTransform::operator()(CFG::FunctionInfo const& _functionInf void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call) { - yulAssert(m_stack.size() >= _call.function.get().arguments.size() + 1, ""); + yulAssert(m_stack.size() >= _call.referencedFunction.get().parameters.size() + 1, ""); auto returnLabel = m_returnLabels.at(&_call.functionCall.get()); // Assert that we got a correct arguments on stack for the call. @@ -137,21 +138,11 @@ void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call) m_assembly.setSourceLocation(locationOf(_call)); m_assembly.appendJumpTo( - getFunctionLabel(_call.function), - static_cast(_call.function.get().returns.size() - _call.function.get().arguments.size()) - 1, + getFunctionLabel(_call.functionCall.get().functionName.name), + static_cast(_call.referencedFunction.get().returnVariables.size() - _call.referencedFunction.get().parameters.size()) - 1, AbstractAssembly::JumpType::IntoFunction ); m_assembly.appendLabel(returnLabel); - // Remove arguments and return label from m_stack. - for (size_t i = 0; i < _call.function.get().arguments.size() + 1; ++i) - m_stack.pop_back(); - // Push return values to m_stack. - ranges::actions::push_back( - m_stack, - ranges::views::iota(0u, _call.function.get().returns.size()) | - ranges::views::transform([&](size_t _i) -> StackSlot { return TemporarySlot{_call.functionCall, _i}; }) - ); - yulAssert(m_assembly.stackHeight() == static_cast(m_stack.size()), ""); } void OptimizedEVMCodeTransform::operator()(CFG::BuiltinCall const& _call) @@ -168,27 +159,10 @@ void OptimizedEVMCodeTransform::operator()(CFG::BuiltinCall const& _call) m_assembly.setSourceLocation(locationOf(_call)); static_cast(_call.builtin.get()).generateCode(_call.functionCall, m_assembly, m_builtinContext, [](auto&&){}); - // Remove arguments from m_stack. - for (size_t i = 0; i < _call.arguments; ++i) - m_stack.pop_back(); - // Push return values to m_stack. - ranges::actions::push_back( - m_stack, - ranges::views::iota(0u, _call.builtin.get().returns.size()) | - ranges::views::transform([&](size_t _i) -> StackSlot { return TemporarySlot{_call.functionCall, _i};}) - ); - yulAssert(m_assembly.stackHeight() == static_cast(m_stack.size()), ""); } -void OptimizedEVMCodeTransform::operator()(CFG::Assignment const& _assignment) +void OptimizedEVMCodeTransform::operator()(CFG::Assignment const&) { - for (auto& currentSlot: m_stack) - if (VariableSlot const* varSlot = get_if(¤tSlot)) - if (util::findOffset(_assignment.variables, *varSlot)) - currentSlot = JunkSlot{}; - - for (auto&& [currentSlot, varSlot]: ranges::zip_view(m_stack | ranges::views::take_last(_assignment.variables.size()), _assignment.variables)) - currentSlot = varSlot; } void OptimizedEVMCodeTransform::operator()(CFG::BasicBlock const& _block) @@ -209,6 +183,14 @@ void OptimizedEVMCodeTransform::operator()(CFG::BasicBlock const& _block) { createStackLayout(m_stackLayout.operationEntryLayout.at(&operation)); std::visit(*this, operation.operation); + + for (auto& currentSlot: m_stack) + if (util::findOffset(operation.output, currentSlot)) + currentSlot = JunkSlot{}; + + for (size_t i = 0; i < operation.input.size(); ++i) + m_stack.pop_back(); + m_stack += operation.output; } createStackLayout(exitLayout); @@ -271,8 +253,8 @@ void OptimizedEVMCodeTransform::operator()(CFG::BasicBlock const& _block) yulAssert(m_currentFunctionInfo, ""); yulAssert(m_currentFunctionInfo == _functionReturn.info, ""); - Stack exitStack = m_currentFunctionInfo->returnVariables | ranges::views::transform([](auto const& _varSlot){ - return StackSlot{_varSlot}; + Stack exitStack = m_currentFunctionInfo->function->returnVariables | ranges::views::transform([](auto const& _var){ + return StackSlot{VariableSlot{_var.name, _var.debugData}}; }) | ranges::to; exitStack.emplace_back(FunctionReturnLabelSlot{}); @@ -401,7 +383,10 @@ void OptimizedEVMCodeTransform::createStackLayout(Stack _targetStack) [&](VariableSlot const& _variable) { if (m_currentFunctionInfo) - if (util::contains(m_currentFunctionInfo->returnVariables, _variable)) + if (util::contains_if( + m_currentFunctionInfo->function->returnVariables, + [&](TypedName const& _var) { return _var.name == _variable.variable; } + )) { // TODO: maybe track uninitialized return variables. m_assembly.appendConstant(0); @@ -409,10 +394,6 @@ void OptimizedEVMCodeTransform::createStackLayout(Stack _targetStack) } yulAssert(false, "Variable not found on stack."); }, - [&](TemporarySlot const&) - { - yulAssert(false, "Function call result requested, but not found on stack."); - }, [&](JunkSlot const&) { // Note: this will always be popped, so we can push anything. @@ -439,6 +420,27 @@ void OptimizedEVMCodeTransform::createStackLayout(Stack _targetStack) m_stack.emplace_back(slot); } +namespace +{ +Block preprocess(EVMDialect const& _dialect, AsmAnalysisInfo const& _analysisInfo, Block const& _block) +{ + std::set externallyUsedIdentifiers; + Disambiguator disambiguator{_dialect, _analysisInfo, externallyUsedIdentifiers}; + Block resultBlock = disambiguator.translate(_block); + NameDispenser nameDispenser{_dialect, resultBlock, {}}; + std::set reservedIdentifiers; + OptimiserStepContext context{ + _dialect, + nameDispenser, + reservedIdentifiers, + nullopt // TODO: pass a proper value in here? + }; + ForLoopConditionIntoBody::run(context, resultBlock); + ExpressionSplitter::run(context, resultBlock); + return resultBlock; +} +} + void OptimizedEVMCodeTransform::run( AbstractAssembly& _assembly, AsmAnalysisInfo& _analysisInfo, @@ -449,10 +451,11 @@ void OptimizedEVMCodeTransform::run( bool _useNamedLabelsForFunctions ) { - std::unique_ptr dfg = ControlFlowGraphBuilder::build(_analysisInfo, _dialect, _block); + Block block = preprocess(_dialect, _analysisInfo, _block); + std::unique_ptr dfg = ControlFlowGraphBuilder::build(_analysisInfo, _dialect, block); StackLayout stackLayout = StackLayoutGenerator::run(*dfg); OptimizedEVMCodeTransform optimizedCodeTransform(_assembly, _builtinContext, _useNamedLabelsForFunctions, *dfg, stackLayout); optimizedCodeTransform(*dfg->entry); - for (Scope::Function const* function: dfg->functions) + for (YulString function: dfg->functions) optimizedCodeTransform(dfg->functionInfo.at(function)); } diff --git a/libyul/backends/evm/OptimizedEVMCodeTransform.h b/libyul/backends/evm/OptimizedEVMCodeTransform.h index e28ed8024..ef3889efb 100644 --- a/libyul/backends/evm/OptimizedEVMCodeTransform.h +++ b/libyul/backends/evm/OptimizedEVMCodeTransform.h @@ -60,7 +60,7 @@ private: StackLayout const& _stackLayout ); - AbstractAssembly::LabelID getFunctionLabel(Scope::Function const& _function); + AbstractAssembly::LabelID getFunctionLabel(YulString _functionName); /// Shuffles m_stack to the desired @a _targetStack while emitting the shuffling code to m_assembly. void createStackLayout(Stack _targetStack); @@ -100,7 +100,7 @@ private: Stack m_stack; std::map m_returnLabels; std::map m_blockLabels; - std::map m_functionLabels; + std::map m_functionLabels; /// Set of blocks already generated. If any of the contained blocks is ever jumped to, m_blockLabels should /// contain a jump label for it. std::set m_generated; diff --git a/libyul/backends/evm/StackHelpers.h b/libyul/backends/evm/StackHelpers.h index a656e73dc..2672adb2a 100644 --- a/libyul/backends/evm/StackHelpers.h +++ b/libyul/backends/evm/StackHelpers.h @@ -34,9 +34,8 @@ inline std::string stackSlotToString(StackSlot const& _slot) return std::visit(util::GenericVisitor{ [](FunctionCallReturnLabelSlot const& _ret) -> std::string { return "RET[" + _ret.call.get().functionName.name.str() + "]"; }, [](FunctionReturnLabelSlot const&) -> std::string { return "RET"; }, - [](VariableSlot const& _var) { return _var.variable.get().name.str(); }, + [](VariableSlot const& _var) { return _var.variable.str(); }, [](LiteralSlot const& _lit) { return util::toCompactHexWithPrefix(_lit.value); }, - [](TemporarySlot const& _tmp) -> std::string { return "TMP[" + _tmp.call.get().functionName.name.str() + ", " + std::to_string(_tmp.index) + "]"; }, [](JunkSlot const&) -> std::string { return "JUNK"; } }, _slot); } diff --git a/libyul/backends/evm/StackLayoutGenerator.cpp b/libyul/backends/evm/StackLayoutGenerator.cpp index 189b50c51..bce37bfe3 100644 --- a/libyul/backends/evm/StackLayoutGenerator.cpp +++ b/libyul/backends/evm/StackLayoutGenerator.cpp @@ -135,11 +135,9 @@ Stack StackLayoutGenerator::propagateStackThroughOperation(Stack _exitStack, CFG stack = createIdealLayout(stack, layout); - if (auto const* assignment = get_if(&_operation.operation)) - for (auto& stackSlot: stack) - if (auto const* varSlot = get_if(&stackSlot)) - if (util::findOffset(assignment->variables, *varSlot)) - stackSlot = JunkSlot{}; + for (auto& stackSlot: stack) + if (util::findOffset(_operation.output, stackSlot)) + stackSlot = JunkSlot{}; for (StackSlot const& input: _operation.input) stack.emplace_back(input); @@ -241,8 +239,8 @@ void StackLayoutGenerator::processEntryPoint(CFG::BasicBlock const& _entry) { visited.emplace(block); yulAssert(_functionReturn.info, ""); - Stack stack = _functionReturn.info->returnVariables | ranges::views::transform([](auto const& _varSlot){ - return StackSlot{_varSlot}; + Stack stack = _functionReturn.info->function->returnVariables | ranges::views::transform([](auto const& _var){ + return StackSlot{VariableSlot{_var.name, _var.debugData}}; }) | ranges::to; stack.emplace_back(FunctionReturnLabelSlot{}); return stack; @@ -486,7 +484,7 @@ void StackLayoutGenerator::fixStackTooDeep(CFG::BasicBlock const& _block) { for (auto& slot: unreachable) if (VariableSlot const* varSlot = get_if(&slot)) - if (util::findOffset(assignment->variables, *varSlot)) + if (util::findOffset(previousOperation.output, *varSlot)) { // TODO: proper warning std::cout << "Unreachable slot after assignment." << std::endl; diff --git a/libyul/optimiser/FunctionDefinitionCollector.cpp b/libyul/optimiser/FunctionDefinitionCollector.cpp index 70f2a268d..dff57a32a 100644 --- a/libyul/optimiser/FunctionDefinitionCollector.cpp +++ b/libyul/optimiser/FunctionDefinitionCollector.cpp @@ -22,7 +22,7 @@ using namespace std; using namespace solidity; using namespace solidity::yul; -map FunctionDefinitionCollector::run(Block& _block) +map FunctionDefinitionCollector::run(Block const& _block) { FunctionDefinitionCollector functionDefinitionCollector; functionDefinitionCollector(_block); diff --git a/libyul/optimiser/FunctionDefinitionCollector.h b/libyul/optimiser/FunctionDefinitionCollector.h index c97f20d67..c9828aced 100644 --- a/libyul/optimiser/FunctionDefinitionCollector.h +++ b/libyul/optimiser/FunctionDefinitionCollector.h @@ -34,7 +34,7 @@ namespace solidity::yul class FunctionDefinitionCollector: ASTWalker { public: - static std::map run(Block& _block); + static std::map run(Block const& _block); private: using ASTWalker::operator(); void operator()(FunctionDefinition const& _functionDefinition) override; diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol index db23d78d3..6496ecbbe 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_decode_v2_storage.sol @@ -24,6 +24,6 @@ contract C { // compileViaYul: also // ---- // f() -> 0x20, 0x8, 0x40, 0x3, 0x9, 0xa, 0xb -// gas irOptimized: 204081 +// gas irOptimized: 203850 // gas legacy: 206126 // gas legacyOptimized: 203105 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol index c6f6c8ff0..5585bae92 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/abi_encode_calldata_slice.sol @@ -60,10 +60,10 @@ contract C { // compileViaYul: also // ---- // test_bytes() -> -// gas irOptimized: 390740 +// gas irOptimized: 391331 // gas legacy: 423563 // gas legacyOptimized: 331391 // test_uint256() -> -// gas irOptimized: 546333 +// gas irOptimized: 545939 // gas legacy: 591392 // gas legacyOptimized: 456137 diff --git a/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol b/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol index 5dbc6f44b..469f646de 100644 --- a/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol +++ b/test/libsolidity/semanticTests/abiEncoderV1/struct/struct_storage_ptr.sol @@ -26,6 +26,6 @@ contract C { // ---- // library: L // f() -> 8, 7, 1, 2, 7, 12 -// gas irOptimized: 166704 +// gas irOptimized: 166726 // gas legacy: 169475 // gas legacyOptimized: 167397 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol index 90a0518c3..5e6f73f32 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_calldata_slice.sol @@ -61,10 +61,10 @@ contract C { // compileViaYul: also // ---- // test_bytes() -> -// gas irOptimized: 390740 +// gas irOptimized: 391331 // gas legacy: 423563 // gas legacyOptimized: 331391 // test_uint256() -> -// gas irOptimized: 546333 +// gas irOptimized: 545939 // gas legacy: 591392 // gas legacyOptimized: 456137 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol index fc62b43bb..f90bc4c99 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2.sol @@ -53,6 +53,6 @@ contract C { // f2() -> 0x20, 0xa0, 0x1, 0x60, 0x2, 0x3, "abc" // f3() -> 0x20, 0xa0, 0x1, 0x60, 0x2, 0x3, "abc" // f4() -> 0x20, 0x160, 0x1, 0x80, 0xc0, 0x2, 0x3, "abc", 0x7, 0x40, 0x2, 0x2, 0x3 -// gas irOptimized: 113098 +// gas irOptimized: 113136 // gas legacy: 114728 // gas legacyOptimized: 112606 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol index 335a2401a..4a114fbb3 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_function_inherited_in_v1_contract.sol @@ -32,6 +32,6 @@ contract C is B { // compileViaYul: also // ---- // test() -> 77 -// gas irOptimized: 127054 +// gas irOptimized: 128462 // gas legacy: 155249 // gas legacyOptimized: 111743 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol index 8fe8b3ae3..03cc9e845 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/abi_encode_v2_in_modifier_used_in_v1_contract.sol @@ -40,5 +40,5 @@ contract C is B { // compileViaYul: also // ---- // test() -> 5, 10 -// gas irOptimized: 89080 +// gas irOptimized: 89268 // gas legacy: 99137 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol index acf9d8c48..b499d2049 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/calldata_array.sol @@ -21,6 +21,6 @@ contract C { // f(uint256[][1]): 32, 32, 0 -> true // f(uint256[][1]): 32, 32, 1, 42 -> true // f(uint256[][1]): 32, 32, 8, 421, 422, 423, 424, 425, 426, 427, 428 -> true -// gas irOptimized: 133946 +// gas irOptimized: 133413 // gas legacy: 141900 // gas legacyOptimized: 121788 diff --git a/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol index d45b52ba9..04d5ce481 100644 --- a/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol +++ b/test/libsolidity/semanticTests/abiEncoderV2/storage_array_encoding.sol @@ -19,10 +19,10 @@ contract C { // compileViaYul: also // ---- // h(uint256[2][]): 0x20, 3, 123, 124, 223, 224, 323, 324 -> 32, 256, 0x20, 3, 123, 124, 223, 224, 323, 324 -// gas irOptimized: 181484 +// gas irOptimized: 181544 // gas legacy: 184929 // gas legacyOptimized: 181504 // i(uint256[2][2]): 123, 124, 223, 224 -> 32, 128, 123, 124, 223, 224 -// gas irOptimized: 112920 +// gas irOptimized: 112957 // gas legacy: 115468 // gas legacyOptimized: 112988 diff --git a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol index 9fb7c6112..9324bc6c5 100644 --- a/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol +++ b/test/libsolidity/semanticTests/abiencodedecode/abi_decode_simple_storage.sol @@ -11,6 +11,6 @@ contract C { // compileViaYul: also // ---- // f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg" -// gas irOptimized: 136127 +// gas irOptimized: 136189 // gas legacy: 137190 // gas legacyOptimized: 136082 diff --git a/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol b/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol index ebd0144a1..45de5e0ec 100644 --- a/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol +++ b/test/libsolidity/semanticTests/array/arrays_complex_from_and_to_storage.sol @@ -14,7 +14,7 @@ contract Test { // compileViaYul: also // ---- // set(uint24[3][]): 0x20, 0x06, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12 -> 0x06 -// gas irOptimized: 189863 +// gas irOptimized: 190592 // gas legacy: 211485 // gas legacyOptimized: 206394 // data(uint256,uint256): 0x02, 0x02 -> 0x09 diff --git a/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol index 9fcb58ad4..5de37147b 100644 --- a/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol +++ b/test/libsolidity/semanticTests/array/byte_array_storage_layout.sol @@ -47,7 +47,7 @@ contract c { // gas legacyOptimized: 58606 // storageEmpty -> 0 // test_long() -> 67 -// gas irOptimized: 90990 +// gas irOptimized: 91086 // gas legacy: 103590 // gas legacyOptimized: 101044 // storageEmpty -> 0 diff --git a/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol index d94095054..529d26897 100644 --- a/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol +++ b/test/libsolidity/semanticTests/array/byte_array_transitional_2.sol @@ -19,6 +19,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0 -// gas irOptimized: 161154 +// gas irOptimized: 161577 // gas legacy: 189715 // gas legacyOptimized: 184472 diff --git a/test/libsolidity/semanticTests/array/bytes_length_member.sol b/test/libsolidity/semanticTests/array/bytes_length_member.sol index 28f39416c..9b6578a02 100644 --- a/test/libsolidity/semanticTests/array/bytes_length_member.sol +++ b/test/libsolidity/semanticTests/array/bytes_length_member.sol @@ -15,7 +15,7 @@ contract c { // ---- // getLength() -> 0 // set(): 1, 2 -> true -// gas irOptimized: 110451 +// gas irOptimized: 110490 // gas legacy: 110726 // gas legacyOptimized: 110567 // getLength() -> 68 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_calldata_storage.sol b/test/libsolidity/semanticTests/array/copying/array_copy_calldata_storage.sol index 5e71647f4..b8c27aec9 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_calldata_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_calldata_storage.sol @@ -22,7 +22,7 @@ contract c { // compileViaYul: also // ---- // store(uint256[9],uint8[3][]): 21, 22, 23, 24, 25, 26, 27, 28, 29, 0x140, 4, 1, 2, 3, 11, 12, 13, 21, 22, 23, 31, 32, 33 -> 32 -// gas irOptimized: 651532 +// gas irOptimized: 651217 // gas legacy: 694515 // gas legacyOptimized: 694013 // retrieve() -> 9, 28, 9, 28, 4, 3, 32 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint128.sol b/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint128.sol index 7a7bf9cbe..83ed44122 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint128.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint128.sol @@ -23,6 +23,6 @@ contract C { // compileViaYul: also // ---- // f() -> true -// gas irOptimized: 91272 +// gas irOptimized: 91314 // gas legacy: 93035 // gas legacyOptimized: 92257 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint40.sol b/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint40.sol index b0db23179..d4adae56e 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint40.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_cleanup_uint40.sol @@ -48,6 +48,6 @@ contract C { // compileViaYul: also // ---- // f() -> true -// gas irOptimized: 146336 +// gas irOptimized: 146435 // gas legacy: 155961 // gas legacyOptimized: 153588 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage.sol b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage.sol index 9d5ea2405..8cde89735 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage.sol @@ -15,6 +15,6 @@ contract C { // compileViaYul: also // ---- // f() -> 0 -// gas irOptimized: 134523 +// gas irOptimized: 134557 // gas legacy: 135313 // gas legacyOptimized: 134548 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol index 685814275..cb001a316 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_clear_storage_packed.sol @@ -42,11 +42,11 @@ contract C { // compileViaYul: also // ---- // f() -> 0 -// gas irOptimized: 91293 +// gas irOptimized: 91323 // gas legacy: 93006 // gas legacyOptimized: 92261 // g() -> 0 // h() -> 0 -// gas irOptimized: 91380 +// gas irOptimized: 91419 // gas legacy: 93028 // gas legacyOptimized: 92303 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol b/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol index 52f68282c..e7b131c09 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_different_packing.sol @@ -21,6 +21,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000 -// gas irOptimized: 210357 +// gas irOptimized: 210566 // gas legacy: 221883 // gas legacyOptimized: 220734 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol b/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol index cdd9b55d4..f41066858 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_including_array.sol @@ -37,12 +37,12 @@ contract c { // compileViaYul: also // ---- // test() -> 0x02000202 -// gas irOptimized: 4682282 +// gas irOptimized: 4718817 // gas legacy: 4578341 // gas legacyOptimized: 4548354 // storageEmpty -> 1 // clear() -> 0, 0 -// gas irOptimized: 4506598 +// gas irOptimized: 4541950 // gas legacy: 4410769 // gas legacyOptimized: 4382531 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol b/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol index d9095cb4e..eac843468 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_nested_array.sol @@ -15,6 +15,6 @@ contract c { // compileViaYul: also // ---- // test(uint256[2][]): 32, 3, 7, 8, 9, 10, 11, 12 -> 10 -// gas irOptimized: 690179 +// gas irOptimized: 690611 // gas legacy: 686268 // gas legacyOptimized: 685688 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base.sol index 3d802087b..60e0b5654 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base.sol @@ -19,6 +19,6 @@ contract c { // compileViaYul: also // ---- // test() -> 5, 4 -// gas irOptimized: 225242 +// gas irOptimized: 225317 // gas legacy: 233801 // gas legacyOptimized: 232816 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol index 82987af7b..13ebbfeb7 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_different_base_nested.sol @@ -24,6 +24,6 @@ contract c { // compileViaYul: also // ---- // test() -> 3, 4 -// gas irOptimized: 190637 +// gas irOptimized: 191011 // gas legacy: 195353 // gas legacyOptimized: 192441 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol index 40ce42999..d9b76f5e3 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dyn_dyn.sol @@ -17,7 +17,7 @@ contract c { // ---- // setData1(uint256,uint256,uint256): 10, 5, 4 -> // copyStorageStorage() -> -// gas irOptimized: 111429 +// gas irOptimized: 111477 // gas legacy: 109278 // gas legacyOptimized: 109268 // getData2(uint256): 5 -> 10, 4 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol index 90ea313d9..751450d41 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_dynamic_dynamic.sol @@ -20,6 +20,6 @@ contract c { // compileViaYul: also // ---- // test() -> 5, 4 -// gas irOptimized: 272096 +// gas irOptimized: 272118 // gas legacy: 270834 // gas legacyOptimized: 269960 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol index 76bbe1354..5ae847630 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_dynamic.sol @@ -14,6 +14,6 @@ contract c { // compileViaYul: also // ---- // test() -> 9, 4 -// gas irOptimized: 123221 +// gas irOptimized: 123293 // gas legacy: 123579 // gas legacyOptimized: 123208 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol index 89a96426c..f247eeeea 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_static_static.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test() -> 8, 0 -// gas irOptimized: 236388 +// gas irOptimized: 236614 // gas legacy: 234695 // gas legacyOptimized: 234103 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_struct.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_struct.sol index dbf8d6fa3..267ce9bec 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_struct.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_storage_struct.sol @@ -19,7 +19,7 @@ contract c { // compileViaYul: also // ---- // test() -> 4, 5 -// gas irOptimized: 239059 +// gas irOptimized: 239117 // gas legacy: 238736 // gas legacyOptimized: 237159 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol b/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol index f2dc707a8..5f0dd6a4b 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_storage_to_memory_nested.sol @@ -17,6 +17,6 @@ contract C { // compileViaYul: also // ---- // f() -> 0x20, 2, 0x40, 0xa0, 2, 0, 1, 2, 2, 3 -// gas irOptimized: 160944 +// gas irOptimized: 161175 // gas legacy: 162278 // gas legacyOptimized: 159955 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol index 0c10f7385..3897b77ee 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover.sol @@ -20,6 +20,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000 -// gas irOptimized: 126407 +// gas irOptimized: 127036 // gas legacy: 186406 // gas legacyOptimized: 166126 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol index 3d798df79..9074bf59d 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_leftover2.sol @@ -22,6 +22,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x04000000000000000000000000000000000000000000000000, 0x0, 0x0 -// gas irOptimized: 92325 +// gas irOptimized: 92314 // gas legacy: 97451 // gas legacyOptimized: 94200 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol index 66dd5b670..3d36bac47 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple.sol @@ -22,6 +22,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0 -// gas irOptimized: 293911 +// gas irOptimized: 293994 // gas legacy: 303653 // gas legacyOptimized: 301999 diff --git a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol index f44795a3b..2232eac4d 100644 --- a/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol +++ b/test/libsolidity/semanticTests/array/copying/array_copy_target_simple_2.sol @@ -22,6 +22,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x00 -// gas irOptimized: 273418 +// gas irOptimized: 273459 // gas legacy: 276381 // gas legacyOptimized: 275453 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol index 4341b2df5..e35a03843 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_calldata_to_storage.sol @@ -38,10 +38,10 @@ contract c { // compileViaYul: true // ---- // test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65 -// gas irOptimized: 180097 +// gas irOptimized: 180271 // test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65 -// gas irOptimized: 157464 +// gas irOptimized: 157522 // test3(uint256[2][]): 0x20, 2, 23, 42, 23, 42 -> 2, 65 -// gas irOptimized: 134984 +// gas irOptimized: 135009 // test4(uint256[2][2]): 23, 42, 23, 42 -> 65 -// gas irOptimized: 111483 +// gas irOptimized: 111516 diff --git a/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol index cfc602019..950ad9f47 100644 --- a/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_nested_memory_to_storage.sol @@ -40,12 +40,12 @@ contract Test { // compileViaYul: also // ---- // test() -> 24 -// gas irOptimized: 226186 +// gas irOptimized: 226125 // gas legacy: 227133 // gas legacyOptimized: 226547 // test1() -> 3 // test2() -> 6 // test3() -> 24 -// gas irOptimized: 133423 +// gas irOptimized: 133375 // gas legacy: 134295 // gas legacyOptimized: 133383 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol index 7f7948228..f8d5dd46c 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_struct_calldata_to_storage.sol @@ -17,4 +17,4 @@ contract C { // compileViaYul: true // ---- // f((uint128,uint64,uint128)[]): 0x20, 3, 0, 0, 12, 0, 11, 0, 10, 0, 0 -> 10, 11, 12 -// gas irOptimized: 120509 +// gas irOptimized: 120557 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_struct_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_struct_memory_to_storage.sol index 9f71affb9..8b5bdcdf7 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_struct_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_struct_memory_to_storage.sol @@ -19,4 +19,4 @@ contract C { // compileViaYul: true // ---- // f() -> 10, 11, 12 -// gas irOptimized: 119248 +// gas irOptimized: 119272 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol index 45204390c..2b7956134 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_calldata_to_storage.sol @@ -23,4 +23,4 @@ contract C { // compileViaYul: true // ---- // f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1 -// gas irOptimized: 321914 +// gas irOptimized: 321698 diff --git a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol index dd3b5429b..5f44b6025 100644 --- a/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/array_of_structs_containing_arrays_memory_to_storage.sol @@ -26,4 +26,4 @@ contract C { // compileViaYul: true // ---- // f() -> 3, 3, 3, 1 -// gas irOptimized: 183750 +// gas irOptimized: 183630 diff --git a/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol b/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol index 45063b11d..f860f0e9a 100644 --- a/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol +++ b/test/libsolidity/semanticTests/array/copying/array_storage_multi_items_per_slot.sol @@ -15,6 +15,6 @@ contract C { // compileViaYul: also // ---- // f() -> 1, 2, 3 -// gas irOptimized: 132265 +// gas irOptimized: 132271 // gas legacy: 134619 // gas legacyOptimized: 131940 diff --git a/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol b/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol index 5588222c6..88b73fc53 100644 --- a/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/arrays_from_and_to_storage.sol @@ -12,7 +12,7 @@ contract Test { // compileViaYul: also // ---- // set(uint24[]): 0x20, 18, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18 -> 18 -// gas irOptimized: 99934 +// gas irOptimized: 100070 // gas legacy: 103815 // gas legacyOptimized: 101614 // data(uint256): 7 -> 8 diff --git a/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol b/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol index 04a782f43..980229227 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_inside_mappings.sol @@ -7,11 +7,11 @@ contract c { // compileViaYul: also // ---- // set(uint256): 1, 2 -> true -// gas irOptimized: 110621 +// gas irOptimized: 110669 // gas legacy: 111091 // gas legacyOptimized: 110736 // set(uint256): 2, 2, 3, 4, 5 -> true -// gas irOptimized: 177590 +// gas irOptimized: 177656 // gas legacy: 178021 // gas legacyOptimized: 177666 // storageEmpty -> 0 diff --git a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol index 4618a557e..0404254d5 100644 --- a/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/bytes_storage_to_storage.sol @@ -19,25 +19,25 @@ contract c { // ---- // f(uint256): 0 -> 0x20, 0x00 // f(uint256): 31 -> 0x20, 0x1f, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e00 -// gas irOptimized: 114862 +// gas irOptimized: 115862 // gas legacy: 124364 // gas legacyOptimized: 119898 // f(uint256): 32 -> 0x20, 0x20, 1780731860627700044960722568376592200742329637303199754547598369979440671 -// gas irOptimized: 121021 +// gas irOptimized: 122326 // gas legacy: 135431 // gas legacyOptimized: 130829 // f(uint256): 33 -> 0x20, 33, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x2000000000000000000000000000000000000000000000000000000000000000 -// gas irOptimized: 127832 +// gas irOptimized: 129212 // gas legacy: 142238 // gas legacyOptimized: 137518 // f(uint256): 63 -> 0x20, 0x3f, 1780731860627700044960722568376592200742329637303199754547598369979440671, 14532552714582660066924456880521368950258152170031413196862950297402215316992 -// gas irOptimized: 133392 +// gas irOptimized: 135762 // gas legacy: 160728 // gas legacyOptimized: 152168 // f(uint256): 12 -> 0x20, 0x0c, 0x0102030405060708090a0b0000000000000000000000000000000000000000 // gas legacy: 59345 // gas legacyOptimized: 57279 // f(uint256): 129 -> 0x20, 0x81, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f, 29063324697304692433803953038474361308315562010425523193971352996434451193439, 0x606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f, -57896044618658097711785492504343953926634992332820282019728792003956564819968 -// gas irOptimized: 367467 +// gas irOptimized: 371822 // gas legacy: 423017 // gas legacyOptimized: 406021 diff --git a/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol b/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol index 81f1d0e61..7e85b7caa 100644 --- a/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/calldata_array_dynamic_to_storage.sol @@ -11,6 +11,6 @@ contract C { // compileViaYul: also // ---- // f(uint256[]): 0x20, 0x03, 0x1, 0x2, 0x3 -> 0x1 -// gas irOptimized: 111103 +// gas irOptimized: 111107 // gas legacy: 111565 // gas legacyOptimized: 111347 diff --git a/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol b/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol index 19149a634..2b168e853 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_byte_array_in_struct_to_storage.sol @@ -37,11 +37,11 @@ contract C { // compileViaYul: also // ---- // f() -> 0x40, 0x80, 6, 0x6162636465660000000000000000000000000000000000000000000000000000, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000 -// gas irOptimized: 180098 +// gas irOptimized: 180170 // gas legacy: 180694 // gas legacyOptimized: 180088 // g() -> 0x40, 0xc0, 0x49, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738393031323334353637383930313233343536373839303120, 0x3132333435363738390000000000000000000000000000000000000000000000, 0x11, 0x3132333435363738393233343536373839000000000000000000000000000000 -// gas irOptimized: 107525 +// gas irOptimized: 107675 // gas legacy: 107895 // gas legacyOptimized: 107254 // h() -> 0x40, 0x60, 0x00, 0x00 diff --git a/test/libsolidity/semanticTests/array/copying/copy_byte_array_to_storage.sol b/test/libsolidity/semanticTests/array/copying/copy_byte_array_to_storage.sol index 14909bb8a..c77129f38 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_byte_array_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_byte_array_to_storage.sol @@ -48,6 +48,6 @@ contract C { // compileViaYul: also // ---- // f() -> 0xff -// gas irOptimized: 120116 +// gas irOptimized: 120185 // gas legacy: 126745 // gas legacyOptimized: 123476 diff --git a/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol b/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol index 645f8fafe..18a67f197 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_function_storage_array.sol @@ -18,6 +18,6 @@ contract C { // compileViaYul: also // ---- // test() -> 7 -// gas irOptimized: 126713 +// gas irOptimized: 127161 // gas legacy: 205196 // gas legacyOptimized: 204987 diff --git a/test/libsolidity/semanticTests/array/copying/copy_removes_bytes_data.sol b/test/libsolidity/semanticTests/array/copying/copy_removes_bytes_data.sol index c2e38e9e5..5e921d6bd 100644 --- a/test/libsolidity/semanticTests/array/copying/copy_removes_bytes_data.sol +++ b/test/libsolidity/semanticTests/array/copying/copy_removes_bytes_data.sol @@ -9,7 +9,7 @@ contract c { // compileViaYul: also // ---- // set(): 1, 2, 3, 4, 5 -> true -// gas irOptimized: 177429 +// gas irOptimized: 177486 // gas legacy: 177656 // gas legacyOptimized: 177496 // storageEmpty -> 0 diff --git a/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol b/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol index 1b3ebf106..93f7cfff9 100644 --- a/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol +++ b/test/libsolidity/semanticTests/array/copying/memory_dyn_2d_bytes_to_storage.sol @@ -20,6 +20,6 @@ contract C { // compileViaYul: also // ---- // f() -> 3 -// gas irOptimized: 128887 +// gas irOptimized: 129013 // gas legacy: 130307 // gas legacyOptimized: 129363 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol index d759ca035..0f268086b 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested.sol @@ -19,6 +19,6 @@ contract C { // compileViaYul: also // ---- // f() -> 1, 2, 3, 4, 5, 6, 7 -// gas irOptimized: 205948 +// gas irOptimized: 206305 // gas legacy: 212325 // gas legacyOptimized: 211486 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol index da11093f5..0ed171bb8 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_bytes.sol @@ -13,6 +13,6 @@ contract C { // compileViaYul: also // ---- // f() -> 0x20, 0x02, 0x40, 0x80, 3, 0x6162630000000000000000000000000000000000000000000000000000000000, 0x99, 44048183304486788312148433451363384677562265908331949128489393215789685032262, 32241931068525137014058842823026578386641954854143559838526554899205067598957, 49951309422467613961193228765530489307475214998374779756599339590522149884499, 0x54555658595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0x4142434445464748494a4b4c4d4e4f5051525354555658595a00000000000000 -// gas irOptimized: 203008 +// gas irOptimized: 203101 // gas legacy: 204459 // gas legacyOptimized: 203437 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol index aae9f5d1d..ed44a01f6 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_nested_from_pointer.sol @@ -20,6 +20,6 @@ contract C { // compileViaYul: also // ---- // f() -> 1, 2, 3, 4, 5, 6, 7 -// gas irOptimized: 205948 +// gas irOptimized: 206305 // gas legacy: 212330 // gas legacyOptimized: 211491 diff --git a/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol b/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol index ab15fde1c..175f8e007 100644 --- a/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol +++ b/test/libsolidity/semanticTests/array/copying/storage_memory_packed_dyn.sol @@ -15,6 +15,6 @@ contract C { // compileViaYul: also // ---- // f() -> 2, 3, 4 -// gas irOptimized: 118794 +// gas irOptimized: 119278 // gas legacy: 126449 // gas legacyOptimized: 120902 diff --git a/test/libsolidity/semanticTests/array/create_memory_array.sol b/test/libsolidity/semanticTests/array/create_memory_array.sol index bd061aa3f..d16f2ff74 100644 --- a/test/libsolidity/semanticTests/array/create_memory_array.sol +++ b/test/libsolidity/semanticTests/array/create_memory_array.sol @@ -20,6 +20,6 @@ contract C { // compileViaYul: also // ---- // f() -> "A", 8, 4, "B" -// gas irOptimized: 128810 +// gas irOptimized: 131723 // gas legacy: 121398 // gas legacyOptimized: 115494 diff --git a/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol b/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol index 67a89baf8..fc79be5d2 100644 --- a/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol +++ b/test/libsolidity/semanticTests/array/delete/bytes_delete_element.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test1() -> true -// gas irOptimized: 212092 +// gas irOptimized: 212798 // gas legacy: 255577 // gas legacyOptimized: 248611 diff --git a/test/libsolidity/semanticTests/array/delete/delete_storage_array_packed.sol b/test/libsolidity/semanticTests/array/delete/delete_storage_array_packed.sol index a76edc963..4f060c644 100644 --- a/test/libsolidity/semanticTests/array/delete/delete_storage_array_packed.sol +++ b/test/libsolidity/semanticTests/array/delete/delete_storage_array_packed.sol @@ -16,4 +16,4 @@ contract C { // compileViaYul: also // ---- // f() -> 0, 0, 0 -// gas irOptimized: 90107 +// gas irOptimized: 90129 diff --git a/test/libsolidity/semanticTests/array/dynamic_array_cleanup.sol b/test/libsolidity/semanticTests/array/dynamic_array_cleanup.sol index 46e3606ba..7fa27f5e5 100644 --- a/test/libsolidity/semanticTests/array/dynamic_array_cleanup.sol +++ b/test/libsolidity/semanticTests/array/dynamic_array_cleanup.sol @@ -16,7 +16,7 @@ contract c { // ---- // storageEmpty -> 1 // fill() -> -// gas irOptimized: 520360 +// gas irOptimized: 520045 // gas legacy: 521773 // gas legacyOptimized: 517048 // storageEmpty -> 0 diff --git a/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol b/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol index 6ff4b9639..f516b40d3 100644 --- a/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol +++ b/test/libsolidity/semanticTests/array/dynamic_arrays_in_storage.sol @@ -44,7 +44,7 @@ contract c { // ---- // getLengths() -> 0, 0 // setLengths(uint256,uint256): 48, 49 -> -// gas irOptimized: 103558 +// gas irOptimized: 103414 // gas legacy: 108571 // gas legacyOptimized: 100417 // getLengths() -> 48, 49 diff --git a/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol b/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol index a3d49eda9..12344c395 100644 --- a/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol +++ b/test/libsolidity/semanticTests/array/dynamic_multi_array_cleanup.sol @@ -18,7 +18,7 @@ contract c { // ---- // storageEmpty -> 1 // fill() -> 8 -// gas irOptimized: 116558 +// gas irOptimized: 116543 // gas legacy: 121756 // gas legacyOptimized: 120687 // storageEmpty -> 0 diff --git a/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol b/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol index c79afa22e..5883e6b2b 100644 --- a/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol +++ b/test/libsolidity/semanticTests/array/fixed_array_cleanup.sol @@ -13,7 +13,7 @@ contract c { // ---- // storageEmpty -> 1 // fill() -> -// gas irOptimized: 465538 +// gas irOptimized: 465727 // gas legacy: 471460 // gas legacyOptimized: 467520 // storageEmpty -> 0 diff --git a/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol b/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol index b7d7927e8..c6212e488 100644 --- a/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol +++ b/test/libsolidity/semanticTests/array/fixed_arrays_as_return_type.sol @@ -21,6 +21,6 @@ contract B { // compileViaYul: also // ---- // f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004 -// gas irOptimized: 116423 +// gas irOptimized: 117039 // gas legacy: 235167 // gas legacyOptimized: 133299 diff --git a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol index 87fa7405a..f873cd410 100644 --- a/test/libsolidity/semanticTests/array/function_array_cross_calls.sol +++ b/test/libsolidity/semanticTests/array/function_array_cross_calls.sol @@ -45,6 +45,6 @@ contract C { // compileViaYul: also // ---- // test() -> 5, 6, 7 -// gas irOptimized: 314380 +// gas irOptimized: 318994 // gas legacy: 463662 // gas legacyOptimized: 296513 diff --git a/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol b/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol index e1278e702..9852285b9 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_array_transition.sol @@ -25,7 +25,7 @@ contract c { // compileViaYul: also // ---- // test() -> 1, 2, 3 -// gas irOptimized: 2270841 +// gas irOptimized: 2274550 // gas legacy: 2273722 // gas legacyOptimized: 2262396 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol b/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol index fff6e7dc3..3d9cbb26f 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_uint16_transition.sol @@ -20,7 +20,7 @@ contract c { // compileViaYul: also // ---- // test() -> 38, 28, 18 -// gas irOptimized: 187932 +// gas irOptimized: 188881 // gas legacy: 189780 // gas legacyOptimized: 178870 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/pop/array_pop_uint24_transition.sol b/test/libsolidity/semanticTests/array/pop/array_pop_uint24_transition.sol index da5928ac0..50be098cc 100644 --- a/test/libsolidity/semanticTests/array/pop/array_pop_uint24_transition.sol +++ b/test/libsolidity/semanticTests/array/pop/array_pop_uint24_transition.sol @@ -20,7 +20,7 @@ contract c { // compileViaYul: also // ---- // test() -> 20, 10 -// gas irOptimized: 159134 +// gas irOptimized: 159770 // gas legacy: 159459 // gas legacyOptimized: 153281 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol index a8ce78a8b..d7c1703f3 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_copy_long.sol @@ -12,6 +12,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x20, 29, 0x0303030303030303030303030303030303030303030303030303030303000000 -// gas irOptimized: 111672 +// gas irOptimized: 112057 // gas legacy: 127309 // gas legacyOptimized: 124136 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol index 4bc2121a9..644191def 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty.sol @@ -18,7 +18,7 @@ contract c { // compileViaYul: also // ---- // test() -> true -// gas irOptimized: 184772 +// gas irOptimized: 184688 // gas legacy: 229864 // gas legacyOptimized: 210964 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol index 1f0e3e9cf..8974f6d26 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_long_storage_empty_garbage_ref.sol @@ -17,7 +17,7 @@ contract c { // compileViaYul: also // ---- // test() -> -// gas irOptimized: 146901 +// gas irOptimized: 145701 // gas legacy: 165363 // gas legacyOptimized: 159446 // storageEmpty -> 1 diff --git a/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol b/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol index 58efe4e32..9af2512f0 100644 --- a/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol +++ b/test/libsolidity/semanticTests/array/pop/byte_array_pop_masking_long.sol @@ -12,6 +12,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000 -// gas irOptimized: 109293 +// gas irOptimized: 109683 // gas legacy: 126187 // gas legacyOptimized: 123261 diff --git a/test/libsolidity/semanticTests/array/push/array_push.sol b/test/libsolidity/semanticTests/array/push/array_push.sol index db234266e..9adf8a805 100644 --- a/test/libsolidity/semanticTests/array/push/array_push.sol +++ b/test/libsolidity/semanticTests/array/push/array_push.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test() -> 5, 4, 3, 3 -// gas irOptimized: 110866 +// gas irOptimized: 110854 // gas legacy: 111838 // gas legacyOptimized: 111128 diff --git a/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol b/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol index 85f8fe143..f3680c6af 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_nested_from_calldata.sol @@ -14,6 +14,6 @@ contract C { // compileViaYul: also // ---- // f(uint120[]): 0x20, 3, 1, 2, 3 -> 1 -// gas irOptimized: 112175 +// gas irOptimized: 112223 // gas legacy: 113686 // gas legacyOptimized: 113499 diff --git a/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol b/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol index 5b8bea17b..f36fccde0 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_packed_array.sol @@ -16,6 +16,6 @@ contract c { // compileViaYul: also // ---- // test() -> 1, 2, 3, 4 -// gas irOptimized: 91505 +// gas irOptimized: 91499 // gas legacy: 92798 // gas legacyOptimized: 92062 diff --git a/test/libsolidity/semanticTests/array/push/array_push_struct.sol b/test/libsolidity/semanticTests/array/push/array_push_struct.sol index cf710c1fa..efbf2eafb 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_struct.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_struct.sol @@ -22,6 +22,6 @@ contract c { // compileViaYul: also // ---- // test() -> 2, 3, 4, 5 -// gas irOptimized: 136581 +// gas irOptimized: 136629 // gas legacy: 147484 // gas legacyOptimized: 146456 diff --git a/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol b/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol index da1fe3ca7..e2a93544b 100644 --- a/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol +++ b/test/libsolidity/semanticTests/array/push/array_push_struct_from_calldata.sol @@ -18,6 +18,6 @@ contract c { // compileViaYul: also // ---- // test((uint16,uint16,uint16[3],uint16[])): 0x20, 2, 3, 0, 0, 4, 0xC0, 4, 0, 0, 5, 0, 0 -> 2, 3, 4, 5 -// gas irOptimized: 138718 +// gas irOptimized: 138766 // gas legacy: 144322 // gas legacyOptimized: 139171 diff --git a/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol b/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol index 515408ec2..4c4871709 100644 --- a/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol +++ b/test/libsolidity/semanticTests/array/push/byte_array_push_transition.sol @@ -17,6 +17,6 @@ contract c { // compileViaYul: also // ---- // test() -> 0 -// gas irOptimized: 178770 +// gas irOptimized: 179115 // gas legacy: 218028 // gas legacyOptimized: 205124 diff --git a/test/libsolidity/semanticTests/array/push/nested_bytes_push.sol b/test/libsolidity/semanticTests/array/push/nested_bytes_push.sol index 21d750a3b..a9e549e1f 100644 --- a/test/libsolidity/semanticTests/array/push/nested_bytes_push.sol +++ b/test/libsolidity/semanticTests/array/push/nested_bytes_push.sol @@ -15,6 +15,6 @@ contract C { // compileViaYul: also // ---- // f() -> -// gas irOptimized: 179269 +// gas irOptimized: 179305 // gas legacy: 180620 // gas legacyOptimized: 180403 diff --git a/test/libsolidity/semanticTests/array/push/push_no_args_2d.sol b/test/libsolidity/semanticTests/array/push/push_no_args_2d.sol index 28dd341fd..8416438c7 100644 --- a/test/libsolidity/semanticTests/array/push/push_no_args_2d.sol +++ b/test/libsolidity/semanticTests/array/push/push_no_args_2d.sol @@ -29,14 +29,14 @@ contract C { // ---- // l() -> 0 // f(uint256,uint256): 42, 64 -> -// gas irOptimized: 113221 +// gas irOptimized: 113236 // gas legacy: 108234 // gas legacyOptimized: 102245 // l() -> 1 // ll(uint256): 0 -> 43 // a(uint256,uint256): 0, 42 -> 64 // f(uint256,uint256): 84, 128 -> -// gas irOptimized: 117765 +// gas irOptimized: 117780 // gas legacy: 107780 // gas legacyOptimized: 96331 // l() -> 2 diff --git a/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol b/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol index 519831ef9..8a54fdc26 100644 --- a/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol +++ b/test/libsolidity/semanticTests/array/push/push_no_args_bytes.sol @@ -23,7 +23,7 @@ contract C { // ---- // l() -> 0 // g(uint256): 70 -> -// gas irOptimized: 189335 +// gas irOptimized: 190085 // gas legacy: 184991 // gas legacyOptimized: 180608 // l() -> 70 diff --git a/test/libsolidity/semanticTests/array/reusing_memory.sol b/test/libsolidity/semanticTests/array/reusing_memory.sol index 3d5af8409..d680adfce 100644 --- a/test/libsolidity/semanticTests/array/reusing_memory.sol +++ b/test/libsolidity/semanticTests/array/reusing_memory.sol @@ -26,6 +26,6 @@ contract Main { // compileViaYul: also // ---- // f(uint256): 0x34 -> 0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1 -// gas irOptimized: 114323 +// gas irOptimized: 114523 // gas legacy: 126852 // gas legacyOptimized: 114079 diff --git a/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol b/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol index 387119622..d0634d509 100644 --- a/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol +++ b/test/libsolidity/semanticTests/constructor/arrays_in_constructors.sol @@ -26,6 +26,6 @@ contract Creator { // compileViaYul: also // ---- // f(uint256,address[]): 7, 0x40, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 -> 7, 8 -// gas irOptimized: 452561 +// gas irOptimized: 454921 // gas legacy: 592626 // gas legacyOptimized: 450224 diff --git a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol index 8ad6433c2..6f2784d31 100644 --- a/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol +++ b/test/libsolidity/semanticTests/constructor/bytes_in_constructors_packer.sol @@ -26,6 +26,6 @@ contract Creator { // compileViaYul: also // ---- // f(uint256,bytes): 7, 0x40, 78, "abcdefghijklmnopqrstuvwxyzabcdef", "ghijklmnopqrstuvwxyzabcdefghijkl", "mnopqrstuvwxyz" -> 7, "h" -// gas irOptimized: 307271 +// gas irOptimized: 306245 // gas legacy: 429173 // gas legacyOptimized: 298384 diff --git a/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol b/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol index 424f86ea1..aeb0e4e92 100644 --- a/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol +++ b/test/libsolidity/semanticTests/constructor/no_callvalue_check.sol @@ -19,6 +19,6 @@ contract C { // compileViaYul: also // ---- // f(), 2000 ether -> true -// gas irOptimized: 123029 +// gas irOptimized: 123629 // gas legacy: 123226 // gas legacyOptimized: 123092 diff --git a/test/libsolidity/semanticTests/events/event_dynamic_array_storage.sol b/test/libsolidity/semanticTests/events/event_dynamic_array_storage.sol index 4dc58c955..6e42ca98d 100644 --- a/test/libsolidity/semanticTests/events/event_dynamic_array_storage.sol +++ b/test/libsolidity/semanticTests/events/event_dynamic_array_storage.sol @@ -15,6 +15,6 @@ contract C { // ---- // createEvent(uint256): 42 -> // ~ emit E(uint256[]): 0x20, 0x03, 0x2a, 0x2b, 0x2c -// gas irOptimized: 113763 +// gas irOptimized: 113721 // gas legacy: 116393 // gas legacyOptimized: 114415 diff --git a/test/libsolidity/semanticTests/events/event_dynamic_array_storage_v2.sol b/test/libsolidity/semanticTests/events/event_dynamic_array_storage_v2.sol index de61c01b0..20f8d4d67 100644 --- a/test/libsolidity/semanticTests/events/event_dynamic_array_storage_v2.sol +++ b/test/libsolidity/semanticTests/events/event_dynamic_array_storage_v2.sol @@ -16,6 +16,6 @@ contract C { // ---- // createEvent(uint256): 42 -> // ~ emit E(uint256[]): 0x20, 0x03, 0x2a, 0x2b, 0x2c -// gas irOptimized: 113763 +// gas irOptimized: 113721 // gas legacy: 116393 // gas legacyOptimized: 114415 diff --git a/test/libsolidity/semanticTests/events/event_dynamic_nested_array_storage_v2.sol b/test/libsolidity/semanticTests/events/event_dynamic_nested_array_storage_v2.sol index 27b8aa8df..f7723b8a9 100644 --- a/test/libsolidity/semanticTests/events/event_dynamic_nested_array_storage_v2.sol +++ b/test/libsolidity/semanticTests/events/event_dynamic_nested_array_storage_v2.sol @@ -17,6 +17,6 @@ contract C { // ---- // createEvent(uint256): 42 -> // ~ emit E(uint256[][]): 0x20, 0x02, 0x40, 0xa0, 0x02, 0x2a, 0x2b, 0x02, 0x2c, 0x2d -// gas irOptimized: 183740 +// gas irOptimized: 183769 // gas legacy: 187621 // gas legacyOptimized: 184551 diff --git a/test/libsolidity/semanticTests/events/event_indexed_string.sol b/test/libsolidity/semanticTests/events/event_indexed_string.sol index 16cc35fa5..ecb097347 100644 --- a/test/libsolidity/semanticTests/events/event_indexed_string.sol +++ b/test/libsolidity/semanticTests/events/event_indexed_string.sol @@ -19,6 +19,6 @@ contract C { // ---- // deposit() -> // ~ emit E(string,uint256[4]): #0xa7fb06bb999a5eb9aff9e0779953f4e1e4ce58044936c2f51c7fb879b85c08bd, #0xe755d8cc1a8cde16a2a31160dcd8017ac32d7e2f13215b29a23cdae40a78aa81 -// gas irOptimized: 344935 +// gas irOptimized: 343678 // gas legacy: 390742 // gas legacyOptimized: 376774 diff --git a/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol b/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol index 489ac57d5..19f29424b 100644 --- a/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol +++ b/test/libsolidity/semanticTests/externalContracts/deposit_contract.sol @@ -178,7 +178,7 @@ contract DepositContract is IDepositContract, ERC165 { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 1624131 +// gas irOptimized: 1654093 // gas legacy: 2580394 // gas legacyOptimized: 1775403 // supportsInterface(bytes4): 0x0 -> 0 @@ -186,27 +186,27 @@ contract DepositContract is IDepositContract, ERC165 { // supportsInterface(bytes4): 0x01ffc9a700000000000000000000000000000000000000000000000000000000 -> true # ERC-165 id # // supportsInterface(bytes4): 0x8564090700000000000000000000000000000000000000000000000000000000 -> true # the deposit interface id # // get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e -// gas irOptimized: 120024 +// gas irOptimized: 120295 // gas legacy: 150465 // gas legacyOptimized: 122798 // get_deposit_count() -> 0x20, 8, 0 # TODO: check balance and logs after each deposit # // deposit(bytes,bytes,bytes,bytes32), 32 ether: 0 -> FAILURE # Empty input # // get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e -// gas irOptimized: 120024 +// gas irOptimized: 120295 // gas legacy: 150465 // gas legacyOptimized: 122798 // get_deposit_count() -> 0x20, 8, 0 // deposit(bytes,bytes,bytes,bytes32), 1 ether: 0x80, 0xe0, 0x120, 0xaa4a8d0b7d9077248630f1a4701ae9764e42271d7f22b7838778411857fd349e, 0x30, 0x933ad9491b62059dd065b560d256d8957a8c402cc6e8d8ee7290ae11e8f73292, 0x67a8811c397529dac52ae1342ba58c9500000000000000000000000000000000, 0x20, 0x00f50428677c60f997aadeab24aabf7fceaef491c96a52b463ae91f95611cf71, 0x60, 0xa29d01cc8c6296a8150e515b5995390ef841dc18948aa3e79be6d7c1851b4cbb, 0x5d6ff49fa70b9c782399506a22a85193151b9b691245cebafd2063012443c132, 0x4b6c36debaedefb7b2d71b0503ffdc00150aaffd42e63358238ec888901738b8 -> # txhash: 0x7085c586686d666e8bb6e9477a0f0b09565b2060a11f1c4209d3a52295033832 # // ~ emit DepositEvent(bytes,bytes,bytes,bytes,bytes): 0xa0, 0x0100, 0x0140, 0x0180, 0x0200, 0x30, 0x933ad9491b62059dd065b560d256d8957a8c402cc6e8d8ee7290ae11e8f73292, 0x67a8811c397529dac52ae1342ba58c9500000000000000000000000000000000, 0x20, 0xf50428677c60f997aadeab24aabf7fceaef491c96a52b463ae91f95611cf71, 0x08, 0xca9a3b00000000000000000000000000000000000000000000000000000000, 0x60, 0xa29d01cc8c6296a8150e515b5995390ef841dc18948aa3e79be6d7c1851b4cbb, 0x5d6ff49fa70b9c782399506a22a85193151b9b691245cebafd2063012443c132, 0x4b6c36debaedefb7b2d71b0503ffdc00150aaffd42e63358238ec888901738b8, 0x08, 0x00 // get_deposit_root() -> 0x2089653123d9c721215120b6db6738ba273bbc5228ac093b1f983badcdc8a438 -// gas irOptimized: 120015 +// gas irOptimized: 120286 // gas legacy: 150475 // gas legacyOptimized: 122811 // get_deposit_count() -> 0x20, 8, 0x0100000000000000000000000000000000000000000000000000000000000000 // deposit(bytes,bytes,bytes,bytes32), 32 ether: 0x80, 0xe0, 0x120, 0xdbd986dc85ceb382708cf90a3500f500f0a393c5ece76963ac3ed72eccd2c301, 0x30, 0xb2ce0f79f90e7b3a113ca5783c65756f96c4b4673c2b5c1eb4efc22280259441, 0x06d601211e8866dc5b50dc48a244dd7c00000000000000000000000000000000, 0x20, 0x00344b6c73f71b11c56aba0d01b7d8ad83559f209d0a4101a515f6ad54c89771, 0x60, 0x945caaf82d18e78c033927d51f452ebcd76524497b91d7a11219cb3db6a1d369, 0x7595fc095ce489e46b2ef129591f2f6d079be4faaf345a02c5eb133c072e7c56, 0x0c6c3617eee66b4b878165c502357d49485326bc6b31bc96873f308c8f19c09d -> # txhash: 0x404d8e109822ce448e68f45216c12cb051b784d068fbe98317ab8e50c58304ac # // ~ emit DepositEvent(bytes,bytes,bytes,bytes,bytes): 0xa0, 0x0100, 0x0140, 0x0180, 0x0200, 0x30, 0xb2ce0f79f90e7b3a113ca5783c65756f96c4b4673c2b5c1eb4efc22280259441, 0x06d601211e8866dc5b50dc48a244dd7c00000000000000000000000000000000, 0x20, 0x344b6c73f71b11c56aba0d01b7d8ad83559f209d0a4101a515f6ad54c89771, 0x08, 0x40597307000000000000000000000000000000000000000000000000000000, 0x60, 0x945caaf82d18e78c033927d51f452ebcd76524497b91d7a11219cb3db6a1d369, 0x7595fc095ce489e46b2ef129591f2f6d079be4faaf345a02c5eb133c072e7c56, 0x0c6c3617eee66b4b878165c502357d49485326bc6b31bc96873f308c8f19c09d, 0x08, 0x0100000000000000000000000000000000000000000000000000000000000000 // get_deposit_root() -> 0x40255975859377d912c53aa853245ebd939bdd2b33a28e084babdcc1ed8238ee -// gas irOptimized: 120015 +// gas irOptimized: 120286 // gas legacy: 150475 // gas legacyOptimized: 122811 // get_deposit_count() -> 0x20, 8, 0x0200000000000000000000000000000000000000000000000000000000000000 diff --git a/test/libsolidity/semanticTests/externalContracts/prbmath_signed.sol b/test/libsolidity/semanticTests/externalContracts/prbmath_signed.sol index 70faa914d..0c7a8a6fa 100644 --- a/test/libsolidity/semanticTests/externalContracts/prbmath_signed.sol +++ b/test/libsolidity/semanticTests/externalContracts/prbmath_signed.sol @@ -50,7 +50,7 @@ contract test { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 2146563 +// gas irOptimized: 2140668 // gas legacy: 2602700 // gas legacyOptimized: 1874490 // div(int256,int256): 3141592653589793238, 88714123 -> 35412542528203691288251815328 @@ -58,7 +58,7 @@ contract test { // gas legacy: 22767 // gas legacyOptimized: 22282 // exp(int256): 3141592653589793238 -> 23140692632779268978 -// gas irOptimized: 25080 +// gas irOptimized: 25077 // gas legacy: 25203 // gas legacyOptimized: 24357 // exp2(int256): 3141592653589793238 -> 8824977827076287620 @@ -66,30 +66,30 @@ contract test { // gas legacy: 24864 // gas legacyOptimized: 24110 // gm(int256,int256): 3141592653589793238, 88714123 -> 16694419339601 -// gas irOptimized: 22742 +// gas irOptimized: 22739 // gas legacy: 23228 // gas legacyOptimized: 22683 // log10(int256): 3141592653589793238 -> 4971498726941338506 -// gas irOptimized: 31156 +// gas irOptimized: 31171 // gas legacy: 32934 // gas legacyOptimized: 30323 // log2(int256): 3141592653589793238 -> 1651496129472318782 -// gas irOptimized: 29361 +// gas irOptimized: 29379 // gas legacy: 31067 // gas legacyOptimized: 28426 // mul(int256,int256): 3141592653589793238, 88714123 -> 278703637 -// gas irOptimized: 22308 +// gas irOptimized: 22305 // gas legacy: 22807 // gas legacyOptimized: 22295 // pow(int256,uint256): 3141592653589793238, 5 -> 306019684785281453040 -// gas irOptimized: 22689 +// gas irOptimized: 22686 // gas legacy: 23508 // gas legacyOptimized: 22921 // sqrt(int256): 3141592653589793238 -> 1772453850905516027 -// gas irOptimized: 22337 +// gas irOptimized: 22340 // gas legacy: 22802 // gas legacyOptimized: 22422 // benchmark(int256): 3141592653589793238 -> 998882724338592125, 1000000000000000000, 1000000000000000000 -// gas irOptimized: 33920 +// gas irOptimized: 34001 // gas legacy: 36673 // gas legacyOptimized: 34729 diff --git a/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol b/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol index d9c98bbc4..00f7100a0 100644 --- a/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol +++ b/test/libsolidity/semanticTests/externalContracts/prbmath_unsigned.sol @@ -50,46 +50,46 @@ contract test { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 1916328 +// gas irOptimized: 1911724 // gas legacy: 2356230 // gas legacyOptimized: 1746528 // div(uint256,uint256): 3141592653589793238, 88714123 -> 35412542528203691288251815328 -// gas irOptimized: 21925 +// gas irOptimized: 21931 // gas legacy: 22497 // gas legacyOptimized: 22010 // exp(uint256): 3141592653589793238 -> 23140692632779268978 -// gas irOptimized: 24850 +// gas irOptimized: 24862 // gas legacy: 25104 // gas legacyOptimized: 24258 // exp2(uint256): 3141592653589793238 -> 8824977827076287620 -// gas irOptimized: 24608 +// gas irOptimized: 24614 // gas legacy: 24814 // gas legacyOptimized: 24062 // gm(uint256,uint256): 3141592653589793238, 88714123 -> 16694419339601 -// gas irOptimized: 22844 +// gas irOptimized: 22847 // gas legacy: 23269 // gas legacyOptimized: 22724 // log10(uint256): 3141592653589793238 -> 0x44fe4fc084a52b8a -// gas irOptimized: 30474 +// gas irOptimized: 30297 // gas legacy: 32898 // gas legacyOptimized: 29925 // log2(uint256): 3141592653589793238 -> 1651496129472318782 -// gas irOptimized: 28344 +// gas irOptimized: 28170 // gas legacy: 30986 // gas legacyOptimized: 28001 // mul(uint256,uint256): 3141592653589793238, 88714123 -> 278703637 -// gas irOptimized: 22001 +// gas irOptimized: 22004 // gas legacy: 22604 // gas legacyOptimized: 22090 // pow(uint256,uint256): 3141592653589793238, 5 -> 306019684785281453040 -// gas irOptimized: 22420 +// gas irOptimized: 22411 // gas legacy: 23245 // gas legacyOptimized: 22646 // sqrt(uint256): 3141592653589793238 -> 1772453850905516027 -// gas irOptimized: 22570 +// gas irOptimized: 22573 // gas legacy: 22820 // gas legacyOptimized: 22440 // benchmark(uint256): 3141592653589793238 -> 998882724338592125, 1000000000000000000, 1000000000000000000 -// gas irOptimized: 35080 +// gas irOptimized: 35158 // gas legacy: 35385 // gas legacyOptimized: 33449 diff --git a/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol b/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol index 9550127bd..29340c644 100644 --- a/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol +++ b/test/libsolidity/semanticTests/externalContracts/ramanujan_pi.sol @@ -35,10 +35,10 @@ contract test { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 530581 +// gas irOptimized: 533861 // gas legacy: 733634 // gas legacyOptimized: 478742 // prb_pi() -> 3141592656369545286 -// gas irOptimized: 58438 +// gas irOptimized: 58678 // gas legacy: 98903 // gas legacyOptimized: 75735 diff --git a/test/libsolidity/semanticTests/externalContracts/snark.sol b/test/libsolidity/semanticTests/externalContracts/snark.sol index 2de28f943..c998d02fa 100644 --- a/test/libsolidity/semanticTests/externalContracts/snark.sol +++ b/test/libsolidity/semanticTests/externalContracts/snark.sol @@ -297,6 +297,6 @@ contract Test { // pair() -> true // verifyTx() -> true // ~ emit Verified(string): 0x20, 0x16, "Successfully verified." -// gas irOptimized: 89789 +// gas irOptimized: 89369 // gas legacy: 114094 // gas legacyOptimized: 83670 diff --git a/test/libsolidity/semanticTests/externalContracts/strings.sol b/test/libsolidity/semanticTests/externalContracts/strings.sol index e0714671e..a9cd8aa96 100644 --- a/test/libsolidity/semanticTests/externalContracts/strings.sol +++ b/test/libsolidity/semanticTests/externalContracts/strings.sol @@ -51,26 +51,26 @@ contract test { // compileViaYul: also // ---- // constructor() -// gas irOptimized: 824381 +// gas irOptimized: 835126 // gas legacy: 1188228 // gas legacyOptimized: 749336 // toSlice(string): 0x20, 11, "hello world" -> 11, 0xa0 -// gas irOptimized: 22628 +// gas irOptimized: 22640 // gas legacy: 23190 // gas legacyOptimized: 22508 // roundtrip(string): 0x20, 11, "hello world" -> 0x20, 11, "hello world" -// gas irOptimized: 23485 +// gas irOptimized: 23503 // gas legacy: 23820 // gas legacyOptimized: 23123 // utf8len(string): 0x20, 16, "\xf0\x9f\x98\x83\xf0\x9f\x98\x83\xf0\x9f\x98\x83\xf0\x9f\x98\x83" -> 4 # Input: "😃😃😃😃" # -// gas irOptimized: 24119 +// gas irOptimized: 24116 // gas legacy: 25716 // gas legacyOptimized: 24115 // multiconcat(string,uint256): 0x40, 3, 11, "hello world" -> 0x20, 0x58, 0x68656c6c6f20776f726c6468656c6c6f20776f726c6468656c6c6f20776f726c, 0x6468656c6c6f20776f726c6468656c6c6f20776f726c6468656c6c6f20776f72, 49027192869463622675296414541903001712009715982962058146354235762728281047040 # concatenating 3 times # -// gas irOptimized: 28865 +// gas irOptimized: 28883 // gas legacy: 31621 // gas legacyOptimized: 27914 // benchmark(string,bytes32): 0x40, 0x0842021, 8, "solidity" -> 0x2020 -// gas irOptimized: 1952705 +// gas irOptimized: 1903782 // gas legacy: 4381235 // gas legacyOptimized: 2317529 diff --git a/test/libsolidity/semanticTests/functionCall/failed_create.sol b/test/libsolidity/semanticTests/functionCall/failed_create.sol index 87a88db9c..5be75f7f2 100644 --- a/test/libsolidity/semanticTests/functionCall/failed_create.sol +++ b/test/libsolidity/semanticTests/functionCall/failed_create.sol @@ -18,7 +18,7 @@ contract C { // compileViaYul: also // ---- // constructor(), 20 wei -// gas irOptimized: 218728 +// gas irOptimized: 219298 // gas legacy: 288299 // gas legacyOptimized: 177933 // f(uint256): 20 -> 1370859564726510389319704988634906228201275401179 @@ -26,7 +26,7 @@ contract C { // f(uint256): 20 -> FAILURE // x() -> 1 // stack(uint256): 1023 -> FAILURE -// gas irOptimized: 338027 +// gas irOptimized: 336725 // gas legacy: 535367 // gas legacyOptimized: 354656 // x() -> 1 diff --git a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol index 6839af670..d8ee695c0 100644 --- a/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol +++ b/test/libsolidity/semanticTests/functionCall/mapping_array_internal_argument.sol @@ -20,7 +20,7 @@ contract test { // compileViaYul: also // ---- // set(uint8,uint8,uint8,uint8,uint8): 1, 21, 22, 42, 43 -> 0, 0, 0, 0 -// gas irOptimized: 111952 +// gas irOptimized: 111961 // gas legacy: 113806 // gas legacyOptimized: 111781 // get(uint8): 1 -> 21, 22, 42, 43 diff --git a/test/libsolidity/semanticTests/functionTypes/store_function.sol b/test/libsolidity/semanticTests/functionTypes/store_function.sol index 3cead8b47..e8b6a3f49 100644 --- a/test/libsolidity/semanticTests/functionTypes/store_function.sol +++ b/test/libsolidity/semanticTests/functionTypes/store_function.sol @@ -28,6 +28,6 @@ contract C { // compileViaYul: also // ---- // t() -> 9 -// gas irOptimized: 99780 +// gas irOptimized: 100177 // gas legacy: 158997 // gas legacyOptimized: 108916 diff --git a/test/libsolidity/semanticTests/immutable/multi_creation.sol b/test/libsolidity/semanticTests/immutable/multi_creation.sol index 5b3c58c63..a5fdedd86 100644 --- a/test/libsolidity/semanticTests/immutable/multi_creation.sol +++ b/test/libsolidity/semanticTests/immutable/multi_creation.sol @@ -29,7 +29,7 @@ contract C { // compileViaYul: also // ---- // f() -> 3, 7, 5 -// gas irOptimized: 129086 +// gas irOptimized: 129480 // gas legacy: 151590 // gas legacyOptimized: 125422 // x() -> 7 diff --git a/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol b/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol index 7dd9db919..fea351632 100644 --- a/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol +++ b/test/libsolidity/semanticTests/inheritance/address_overload_resolution.sol @@ -23,8 +23,8 @@ contract D { // compileViaYul: also // ---- // f() -> 1 -// gas irOptimized: 78517 +// gas irOptimized: 78923 // gas legacy: 115012 // g() -> 5 -// gas irOptimized: 78547 +// gas irOptimized: 78947 // gas legacy: 115472 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol index c79a9f1a0..705b0e73a 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_calldata_interface.sol @@ -25,5 +25,5 @@ contract B { // compileViaYul: also // ---- // g() -> 42 -// gas irOptimized: 85155 +// gas irOptimized: 85101 // gas legacy: 125609 diff --git a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol index eaaf03404..18642c502 100644 --- a/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol +++ b/test/libsolidity/semanticTests/inheritance/inherited_function_calldata_memory_interface.sol @@ -25,6 +25,6 @@ contract B { // compileViaYul: also // ---- // g() -> 42 -// gas irOptimized: 117193 +// gas irOptimized: 116134 // gas legacy: 186609 // gas legacyOptimized: 116151 diff --git a/test/libsolidity/semanticTests/inlineAssembly/keccak_yul_optimization.sol b/test/libsolidity/semanticTests/inlineAssembly/keccak_yul_optimization.sol index c2beb3dc9..ebc5ebbdc 100644 --- a/test/libsolidity/semanticTests/inlineAssembly/keccak_yul_optimization.sol +++ b/test/libsolidity/semanticTests/inlineAssembly/keccak_yul_optimization.sol @@ -26,10 +26,10 @@ contract C { // compileViaYul: also // ---- // f() -> 0xcdb56c384a9682c600315e3470157a4cf7638d0d33e9dae5c40ffd2644fc5a80 -// gas irOptimized: 22307 +// gas irOptimized: 22436 // gas legacy: 23385 // gas legacyOptimized: 23092 // g() -> 0xcdb56c384a9682c600315e3470157a4cf7638d0d33e9dae5c40ffd2644fc5a80 -// gas irOptimized: 21250 +// gas irOptimized: 21253 // gas legacy: 21462 // gas legacyOptimized: 21256 diff --git a/test/libsolidity/semanticTests/interface_inheritance_conversions.sol b/test/libsolidity/semanticTests/interface_inheritance_conversions.sol index 12488e96c..7f4fcac81 100644 --- a/test/libsolidity/semanticTests/interface_inheritance_conversions.sol +++ b/test/libsolidity/semanticTests/interface_inheritance_conversions.sol @@ -37,10 +37,10 @@ contract C { // compileViaYul: also // ---- // convertParent() -> 1 -// gas irOptimized: 87376 +// gas irOptimized: 87958 // convertSubA() -> 1, 2 -// gas irOptimized: 88184 +// gas irOptimized: 88766 // gas legacy: 99303 // convertSubB() -> 1, 3 -// gas irOptimized: 88110 +// gas irOptimized: 88695 // gas legacy: 99237 diff --git a/test/libsolidity/semanticTests/salted_create/salted_create.sol b/test/libsolidity/semanticTests/salted_create/salted_create.sol index 79eb9d9ad..66951b9c1 100644 --- a/test/libsolidity/semanticTests/salted_create/salted_create.sol +++ b/test/libsolidity/semanticTests/salted_create/salted_create.sol @@ -22,6 +22,6 @@ contract A { // ---- // different_salt() -> true // same_salt() -> true -// gas irOptimized: 98438924 +// gas irOptimized: 98438933 // gas legacy: 98439116 // gas legacyOptimized: 98438970 diff --git a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol index b3930d060..380a1fd49 100644 --- a/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol +++ b/test/libsolidity/semanticTests/salted_create/salted_create_with_value.sol @@ -22,6 +22,6 @@ contract A { // compileViaYul: also // ---- // f(), 10 ether -> 3007, 3008, 3009 -// gas irOptimized: 276235 +// gas irOptimized: 276844 // gas legacy: 422627 // gas legacyOptimized: 287856 diff --git a/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol b/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol index 235df89c8..e4552dadc 100644 --- a/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol +++ b/test/libsolidity/semanticTests/storage/packed_storage_structs_bytes.sol @@ -46,6 +46,6 @@ contract C { // compileViaYul: also // ---- // test() -> true -// gas irOptimized: 134021 +// gas irOptimized: 134027 // gas legacy: 136036 // gas legacyOptimized: 133480 diff --git a/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol b/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol index f9c00a297..129a813e1 100644 --- a/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol +++ b/test/libsolidity/semanticTests/structs/conversion/recursive_storage_memory.sol @@ -25,6 +25,6 @@ contract CopyTest { // compileViaYul: also // ---- // run() -> 2, 23, 42 -// gas irOptimized: 195015 +// gas irOptimized: 196629 // gas legacy: 186016 // gas legacyOptimized: 184668 diff --git a/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol b/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol index 9a1778c39..4259c0a55 100644 --- a/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol +++ b/test/libsolidity/semanticTests/structs/memory_structs_nested_load.sol @@ -69,7 +69,7 @@ contract Test { // compileViaYul: also // ---- // load() -> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 -// gas irOptimized: 110429 +// gas irOptimized: 110441 // gas legacy: 112999 // gas legacyOptimized: 110881 // store() -> 0x01, 0x02, 0x03, 0x04, 0x05, 0x06 diff --git a/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol b/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol index c06fc7390..949170677 100644 --- a/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol +++ b/test/libsolidity/semanticTests/structs/struct_containing_bytes_copy_and_delete.sol @@ -25,7 +25,7 @@ contract c { // ---- // storageEmpty -> 1 // set(uint256,bytes,uint256): 12, 0x60, 13, 33, "12345678901234567890123456789012", "3" -> true -// gas irOptimized: 133717 +// gas irOptimized: 133674 // gas legacy: 134436 // gas legacyOptimized: 133879 // test(uint256): 32 -> "3" diff --git a/test/libsolidity/semanticTests/structs/struct_copy.sol b/test/libsolidity/semanticTests/structs/struct_copy.sol index 53bdef7e5..d55408a40 100644 --- a/test/libsolidity/semanticTests/structs/struct_copy.sol +++ b/test/libsolidity/semanticTests/structs/struct_copy.sol @@ -38,12 +38,12 @@ contract c { // compileViaYul: also // ---- // set(uint256): 7 -> true -// gas irOptimized: 110090 +// gas irOptimized: 110087 // gas legacy: 110616 // gas legacyOptimized: 110006 // retrieve(uint256): 7 -> 1, 3, 4, 2 // copy(uint256,uint256): 7, 8 -> true -// gas irOptimized: 118609 +// gas irOptimized: 118602 // gas legacy: 119166 // gas legacyOptimized: 118622 // retrieve(uint256): 7 -> 1, 3, 4, 2 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol index 75a2abcc6..92414e8f3 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage_nested_small.sol @@ -33,4 +33,4 @@ contract C { // compileViaYul: true // ---- // f() -> 0, 0, 0 -// gas irOptimized: 117589 +// gas irOptimized: 117601 diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage_with_array.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage_with_array.sol index ad93c82f1..080a68adc 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage_with_array.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage_with_array.sol @@ -44,7 +44,7 @@ contract C { // compileViaYul: also // ---- // f() -> -// gas irOptimized: 121075 +// gas irOptimized: 121111 // gas legacy: 122132 // gas legacyOptimized: 121500 // g() -> diff --git a/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol b/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol index 7d72b374f..8852bbc9c 100644 --- a/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol +++ b/test/libsolidity/semanticTests/structs/struct_delete_storage_with_arrays_small.sol @@ -27,4 +27,4 @@ contract C { // compileViaYul: true // ---- // f() -> 0 -// gas irOptimized: 111980 +// gas irOptimized: 112025 diff --git a/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol b/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol index b0773e78b..85e1da3fb 100644 --- a/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol +++ b/test/libsolidity/semanticTests/structs/struct_memory_to_storage_function_ptr.sol @@ -32,6 +32,6 @@ contract C { // compileViaYul: also // ---- // f() -> 42, 23, 34, 42, 42 -// gas irOptimized: 110158 +// gas irOptimized: 110170 // gas legacy: 112021 // gas legacyOptimized: 110548 diff --git a/test/libsolidity/semanticTests/structs/structs.sol b/test/libsolidity/semanticTests/structs/structs.sol index 8b2771be4..19428ac1f 100644 --- a/test/libsolidity/semanticTests/structs/structs.sol +++ b/test/libsolidity/semanticTests/structs/structs.sol @@ -32,7 +32,7 @@ contract test { // ---- // check() -> false // set() -> -// gas irOptimized: 134588 +// gas irOptimized: 134591 // gas legacy: 135277 // gas legacyOptimized: 134064 // check() -> true diff --git a/test/libsolidity/semanticTests/various/destructuring_assignment.sol b/test/libsolidity/semanticTests/various/destructuring_assignment.sol index ab1f53e02..ed8a409f0 100644 --- a/test/libsolidity/semanticTests/various/destructuring_assignment.sol +++ b/test/libsolidity/semanticTests/various/destructuring_assignment.sol @@ -36,6 +36,6 @@ contract C { // compileViaYul: also // ---- // f(bytes): 0x20, 0x5, "abcde" -> 0 -// gas irOptimized: 239570 +// gas irOptimized: 239324 // gas legacy: 240358 // gas legacyOptimized: 239682 diff --git a/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol b/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol index 5d3adbd76..138557ecd 100644 --- a/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol +++ b/test/libsolidity/semanticTests/various/skip_dynamic_types_for_structs.sol @@ -22,6 +22,6 @@ contract C { // compileViaYul: also // ---- // g() -> 2, 6 -// gas irOptimized: 178857 +// gas irOptimized: 178923 // gas legacy: 180890 // gas legacyOptimized: 179609 diff --git a/test/libsolidity/semanticTests/various/staticcall_for_view_and_pure.sol b/test/libsolidity/semanticTests/various/staticcall_for_view_and_pure.sol index b93c12478..b5f14e3cc 100644 --- a/test/libsolidity/semanticTests/various/staticcall_for_view_and_pure.sol +++ b/test/libsolidity/semanticTests/various/staticcall_for_view_and_pure.sol @@ -38,10 +38,10 @@ contract D { // f() -> 0x1 # This should work, next should throw # // gas legacy: 103844 // fview() -> FAILURE -// gas irOptimized: 98438642 +// gas irOptimized: 98438645 // gas legacy: 98438803 // gas legacyOptimized: 98438596 // fpure() -> FAILURE -// gas irOptimized: 98438643 +// gas irOptimized: 98438646 // gas legacy: 98438803 // gas legacyOptimized: 98438597 diff --git a/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol b/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol index 4626695c1..bf75ca316 100644 --- a/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol +++ b/test/libsolidity/semanticTests/viaYul/array_memory_index_access.sol @@ -28,7 +28,7 @@ contract C { // index(uint256): 10 -> true // index(uint256): 20 -> true // index(uint256): 0xFF -> true -// gas irOptimized: 143528 +// gas irOptimized: 146627 // gas legacy: 248854 // gas legacyOptimized: 152638 // accessIndex(uint256,int256): 10, 1 -> 2 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol index 38f44be79..bafb6af93 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_access.sol @@ -18,33 +18,33 @@ contract C { // ---- // test_indices(uint256): 1 -> // test_indices(uint256): 129 -> -// gas irOptimized: 2989821 +// gas irOptimized: 2991009 // gas legacy: 3071205 // gas legacyOptimized: 3011873 // test_indices(uint256): 5 -> -// gas irOptimized: 371949 +// gas irOptimized: 372033 // gas legacy: 369241 // gas legacyOptimized: 366149 // test_indices(uint256): 10 -> // test_indices(uint256): 15 -> -// gas irOptimized: 67954 +// gas irOptimized: 68143 // test_indices(uint256): 0xFF -> -// gas irOptimized: 3353039 +// gas irOptimized: 3355403 // gas legacy: 3514167 // gas legacyOptimized: 3398107 // test_indices(uint256): 1000 -> -// gas irOptimized: 17981281 +// gas irOptimized: 17991070 // gas legacy: 18617999 // gas legacyOptimized: 18178944 // test_indices(uint256): 129 -> -// gas irOptimized: 2730702 +// gas irOptimized: 2732274 // gas legacy: 2772735 // gas legacyOptimized: 2716547 // test_indices(uint256): 128 -> -// gas irOptimized: 383265 +// gas irOptimized: 384825 // gas legacy: 467272 // gas legacyOptimized: 418424 // test_indices(uint256): 1 -> -// gas irOptimized: 368886 +// gas irOptimized: 368922 // gas legacy: 363407 // gas legacyOptimized: 361811 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol index abe3ab5e6..907ce6c41 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_boundary_test.sol @@ -18,11 +18,11 @@ contract C { // test_boundary_check(uint256,uint256): 1, 1 -> FAILURE, hex"4e487b71", 0x32 // test_boundary_check(uint256,uint256): 10, 10 -> FAILURE, hex"4e487b71", 0x32 // test_boundary_check(uint256,uint256): 256, 256 -> FAILURE, hex"4e487b71", 0x32 -// gas irOptimized: 137880 +// gas irOptimized: 137133 // gas legacy: 131830 // gas legacyOptimized: 112054 // test_boundary_check(uint256,uint256): 256, 255 -> 0 -// gas irOptimized: 139966 +// gas irOptimized: 139225 // gas legacy: 134149 // gas legacyOptimized: 114233 // test_boundary_check(uint256,uint256): 256, 0xFFFF -> FAILURE, hex"4e487b71", 0x32 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol index 78cc8941f..b56f88416 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_index_zeroed_test.sol @@ -54,18 +54,18 @@ contract C { // ---- // test_zeroed_indicies(uint256): 1 -> // test_zeroed_indicies(uint256): 5 -> -// gas irOptimized: 128454 +// gas irOptimized: 128562 // gas legacy: 132367 // gas legacyOptimized: 129586 // test_zeroed_indicies(uint256): 10 -> -// gas irOptimized: 169089 +// gas irOptimized: 169302 // gas legacy: 177329 // gas legacyOptimized: 172224 // test_zeroed_indicies(uint256): 15 -> -// gas irOptimized: 189364 +// gas irOptimized: 189682 // gas legacy: 201954 // gas legacyOptimized: 194604 // test_zeroed_indicies(uint256): 0xFF -> -// gas irOptimized: 5947164 +// gas irOptimized: 5952522 // gas legacy: 6163149 // gas legacyOptimized: 6029474 diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol index d581290dd..278a856bd 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty.sol @@ -13,11 +13,11 @@ contract C { // compileViaYul: also // ---- // pushEmpty(uint256): 128 -// gas irOptimized: 370475 +// gas irOptimized: 370859 // gas legacy: 417287 // gas legacyOptimized: 399048 // pushEmpty(uint256): 256 -// gas irOptimized: 637295 +// gas irOptimized: 638063 // gas legacy: 715083 // gas legacyOptimized: 688908 // pushEmpty(uint256): 48869 -> FAILURE # out-of-gas # diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol index 9402cf909..4b0b3fc13 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_empty_length_address.sol @@ -18,15 +18,15 @@ contract C { // set_get_length(uint256): 10 -> 10 // set_get_length(uint256): 20 -> 20 // set_get_length(uint256): 0 -> 0 -// gas irOptimized: 77835 +// gas irOptimized: 77829 // gas legacy: 77730 // gas legacyOptimized: 77162 // set_get_length(uint256): 0xFF -> 0xFF -// gas irOptimized: 143362 +// gas irOptimized: 142591 // gas legacy: 678237 // gas legacyOptimized: 115104 // set_get_length(uint256): 0xFFF -> 0xFFF -// gas irOptimized: 1824739 +// gas irOptimized: 1813213 // gas legacy: 9873774 // gas legacyOptimized: 1398546 // set_get_length(uint256): 0xFFFFF -> FAILURE # Out-of-gas # diff --git a/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol b/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol index b4cb8f672..01d846d53 100644 --- a/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol +++ b/test/libsolidity/semanticTests/viaYul/array_storage_push_pop.sol @@ -15,15 +15,15 @@ contract C { // set_get_length(uint256): 1 -> 0 // set_get_length(uint256): 10 -> 0 // set_get_length(uint256): 20 -> 0 -// gas irOptimized: 86635 +// gas irOptimized: 86575 // gas legacy: 85822 // gas legacyOptimized: 83608 // set_get_length(uint256): 0xFF -> 0 -// gas irOptimized: 825475 +// gas irOptimized: 824710 // gas legacy: 810327 // gas legacyOptimized: 786258 // set_get_length(uint256): 0xFFF -> 0 -// gas irOptimized: 12898447 +// gas irOptimized: 12886162 // gas legacy: 12649059 // gas legacyOptimized: 12267870 // set_get_length(uint256): 0xFFFF -> FAILURE # Out-of-gas # diff --git a/test/libyul/ControlFlowGraphTest.cpp b/test/libyul/ControlFlowGraphTest.cpp index 819df3c17..e1c8cb405 100644 --- a/test/libyul/ControlFlowGraphTest.cpp +++ b/test/libyul/ControlFlowGraphTest.cpp @@ -53,9 +53,8 @@ static std::string stackSlotToString(StackSlot const& _slot) return std::visit(util::GenericVisitor{ [](FunctionCallReturnLabelSlot const& _ret) -> std::string { return "RET[" + _ret.call.get().functionName.name.str() + "]"; }, [](FunctionReturnLabelSlot const&) -> std::string { return "RET"; }, - [](VariableSlot const& _var) { return _var.variable.get().name.str(); }, + [](VariableSlot const& _var) { return _var.variable.str(); }, [](LiteralSlot const& _lit) { return util::toCompactHexWithPrefix(_lit.value); }, - [](TemporarySlot const& _tmp) -> std::string { return "TMP[" + _tmp.call.get().functionName.name.str() + ", " + std::to_string(_tmp.index) + "]"; }, [](JunkSlot const&) -> std::string { return "JUNK"; } }, _slot); } @@ -68,10 +67,6 @@ static std::string stackToString(Stack const& _stack) result += ']'; return result; } -static std::string variableSlotToString(VariableSlot const& _slot) -{ - return _slot.variable.get().name.str(); -} } class ControlFlowGraphPrinter @@ -96,14 +91,14 @@ public: CFG::FunctionInfo const& _info ) { - m_stream << m_indent << "function " << _info.function.name.str() << "("; - m_stream << joinHumanReadable(_info.parameters | ranges::views::transform(variableSlotToString)); + m_stream << m_indent << "function " << _info.function->name.str() << "("; + // TODO m_stream << joinHumanReadable(_info.parameters | ranges::views::transform(variableSlotToString)); m_stream << ")"; - if (!_info.returnVariables.empty()) + /* TODO if (!_info.returnVariables.empty()) { m_stream << " -> "; m_stream << joinHumanReadable(_info.returnVariables | ranges::views::transform(variableSlotToString)); - } + }*/ m_stream << ":\n"; ScopedSaveAndRestore linePrefixRestore(m_indent, m_indent + " "); (*this)(*_info.entry); @@ -128,16 +123,14 @@ private: m_stream << m_indent; std::visit(util::GenericVisitor{ [&](CFG::FunctionCall const& _call) { - m_stream << _call.function.get().name.str() << ": "; + m_stream << _call.functionCall.get().functionName.name.str() << ": "; }, [&](CFG::BuiltinCall const& _call) { m_stream << _call.functionCall.get().functionName.name.str() << ": "; }, - [&](CFG::Assignment const& _assignment) { - m_stream << "Assignment("; - m_stream << joinHumanReadable(_assignment.variables | ranges::views::transform(variableSlotToString)); - m_stream << "): "; + [&](CFG::Assignment const&) { + m_stream << "Assignment: "; } }, operation.operation); m_stream << stackToString(operation.input) << " => " << stackToString(operation.output) << "\n"; @@ -159,7 +152,7 @@ private: }, [&](CFG::BasicBlock::FunctionReturn const& _return) { - m_stream << m_indent << "FunctionReturn of " << _return.info->function.name.str() << "\n"; + m_stream << m_indent << "FunctionReturn of " << _return.info->function->name.str() << "\n"; }, [&](CFG::BasicBlock::Terminated const&) { diff --git a/test/libyul/evmCodeTransform/forLoop.yul b/test/libyul/evmCodeTransform/forLoop.yul new file mode 100644 index 000000000..29f6764f8 --- /dev/null +++ b/test/libyul/evmCodeTransform/forLoop.yul @@ -0,0 +1,12 @@ +{ + let x := calldataload(0) + for {} x { x := add(x, 1) } { + //if lt(x, 0x42) { break } + sstore(x, 0x21) + } + sstore(0x10, 0x10) +} +// ==== +// stackOptimization: true +// ---- +// stop