This commit is contained in:
Daniel 2023-09-22 21:29:09 +00:00 committed by GitHub
commit 419b8afe80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 538 additions and 217 deletions

View File

@ -6,6 +6,7 @@ Language Features:
Compiler Features: Compiler Features:
* Parser: Remove the experimental error recovery mode (``--error-recovery`` / ``settings.parserErrorRecovery``). * Parser: Remove the experimental error recovery mode (``--error-recovery`` / ``settings.parserErrorRecovery``).
* Code Generator: Remove redundant overflow checks in specific for loops.
* Yul Optimizer: If ``PUSH0`` is supported, favor zero literals over storing zero values in variables. * Yul Optimizer: If ``PUSH0`` is supported, favor zero literals over storing zero values in variables.
* Yul Optimizer: Run the ``Rematerializer`` and ``UnusedPruner`` steps at the end of the default clean-up sequence. * Yul Optimizer: Run the ``Rematerializer`` and ``UnusedPruner`` steps at the end of the default clean-up sequence.

View File

@ -24,6 +24,8 @@
#include <liblangutil/SemVerHandler.h> #include <liblangutil/SemVerHandler.h>
#include <libsolutil/Algorithms.h> #include <libsolutil/Algorithms.h>
#include <libsolutil/FunctionSelector.h> #include <libsolutil/FunctionSelector.h>
#include <libyul/optimiser/ASTWalker.h>
#include <libyul/AST.h>
#include <memory> #include <memory>
@ -129,6 +131,17 @@ void PostTypeChecker::endVisit(ModifierInvocation const& _modifierInvocation)
callEndVisit(_modifierInvocation); callEndVisit(_modifierInvocation);
} }
bool PostTypeChecker::visit(ForStatement const& _forStatement)
{
return callVisit(_forStatement);
}
void PostTypeChecker::endVisit(ForStatement const& _forStatement)
{
callEndVisit(_forStatement);
}
namespace namespace
{ {
struct ConstStateVarCircularReferenceChecker: public PostTypeChecker::Checker struct ConstStateVarCircularReferenceChecker: public PostTypeChecker::Checker
@ -421,6 +434,90 @@ struct ReservedErrorSelector: public PostTypeChecker::Checker
} }
}; };
class YulLValueChecker : public solidity::yul::ASTWalker
{
public:
YulLValueChecker(ASTString const& _identifierName): m_identifierName(_identifierName) {}
bool willBeWrittenTo() { return m_willBeWrittenTo; }
using solidity::yul::ASTWalker::operator();
void operator()(solidity::yul::Assignment const& _assignment) override
{
for (auto const& yulIdentifier: _assignment.variableNames)
if (yulIdentifier.name.str() == m_identifierName)
m_willBeWrittenTo = true;
}
private:
ASTString const& m_identifierName;
bool m_willBeWrittenTo = false;
};
class LValueChecker: public ASTConstVisitor
{
public:
LValueChecker(Identifier const& _identifier):
m_declaration(_identifier.annotation().referencedDeclaration)
{}
bool willBeWrittenTo() const { return m_willBeWrittenTo; }
void endVisit(Identifier const& _identifier) override
{
solAssert(_identifier.annotation().referencedDeclaration);
if (
*_identifier.annotation().referencedDeclaration == *m_declaration &&
_identifier.annotation().willBeWrittenTo
)
m_willBeWrittenTo = true;
}
void endVisit(InlineAssembly const& _inlineAssembly) override
{
YulLValueChecker yulChecker{m_declaration->name()};
yulChecker(_inlineAssembly.operations());
m_willBeWrittenTo = yulChecker.willBeWrittenTo();
}
private:
Declaration const* m_declaration{};
bool m_willBeWrittenTo = false;
};
struct SimpleCounterForLoopChecker: public PostTypeChecker::Checker
{
SimpleCounterForLoopChecker(ErrorReporter& _errorReporter): Checker(_errorReporter) {}
bool visit(ForStatement const& _forStatement) override
{
_forStatement.annotation().isSimpleCounterLoop = isSimpleCounterLoop(_forStatement);
return true;
}
bool isSimpleCounterLoop(ForStatement const& _forStatement) const
{
auto const* simpleCondition = dynamic_cast<BinaryOperation const*>(_forStatement.condition());
if (!simpleCondition || simpleCondition->getOperator() != Token::LessThan || simpleCondition->userDefinedFunctionType())
return false;
if (!_forStatement.loopExpression())
return false;
auto const* simplePostExpression = dynamic_cast<UnaryOperation const*>(&_forStatement.loopExpression()->expression());
// This matches both operators ++i and i++
if (!simplePostExpression || simplePostExpression->getOperator() != Token::Inc || simplePostExpression->userDefinedFunctionType())
return false;
auto const* lhsIdentifier = dynamic_cast<Identifier const*>(&simpleCondition->leftExpression());
auto const* lhsIntegerType = dynamic_cast<IntegerType const*>(simpleCondition->leftExpression().annotation().type);
auto const* commonIntegerType = dynamic_cast<IntegerType const*>(simpleCondition->annotation().commonType);
if (!lhsIdentifier || !lhsIntegerType || !commonIntegerType || *lhsIntegerType != *commonIntegerType)
return false;
if (
auto const* incExpressionIdentifier = dynamic_cast<Identifier const*>(&simplePostExpression->subExpression());
incExpressionIdentifier->annotation().referencedDeclaration != lhsIdentifier->annotation().referencedDeclaration
)
return false;
LValueChecker lhsLValueChecker{*lhsIdentifier};
_forStatement.body().accept(lhsLValueChecker);
return !lhsLValueChecker.willBeWrittenTo();
}
};
} }
@ -432,4 +529,5 @@ PostTypeChecker::PostTypeChecker(langutil::ErrorReporter& _errorReporter): m_err
m_checkers.push_back(std::make_shared<EventOutsideEmitErrorOutsideRevertChecker>(_errorReporter)); m_checkers.push_back(std::make_shared<EventOutsideEmitErrorOutsideRevertChecker>(_errorReporter));
m_checkers.push_back(std::make_shared<NoVariablesInInterfaceChecker>(_errorReporter)); m_checkers.push_back(std::make_shared<NoVariablesInInterfaceChecker>(_errorReporter));
m_checkers.push_back(std::make_shared<ReservedErrorSelector>(_errorReporter)); m_checkers.push_back(std::make_shared<ReservedErrorSelector>(_errorReporter));
m_checkers.push_back(std::make_shared<SimpleCounterForLoopChecker>(_errorReporter));
} }

View File

@ -97,6 +97,9 @@ private:
bool visit(ModifierInvocation const& _modifierInvocation) override; bool visit(ModifierInvocation const& _modifierInvocation) override;
void endVisit(ModifierInvocation const& _modifierInvocation) override; void endVisit(ModifierInvocation const& _modifierInvocation) override;
bool visit(ForStatement const& _forStatement) override;
void endVisit(ForStatement const& _forStatement) override;
template <class T> template <class T>
bool callVisit(T const& _node) bool callVisit(T const& _node)
{ {

View File

@ -238,6 +238,7 @@ struct TryCatchClauseAnnotation: ASTAnnotation, ScopableAnnotation
struct ForStatementAnnotation: StatementAnnotation, ScopableAnnotation struct ForStatementAnnotation: StatementAnnotation, ScopableAnnotation
{ {
util::SetOnce<bool> isSimpleCounterLoop;
}; };
struct ReturnAnnotation: StatementAnnotation struct ReturnAnnotation: StatementAnnotation

View File

@ -742,12 +742,18 @@ bool ASTJsonExporter::visit(WhileStatement const& _node)
bool ASTJsonExporter::visit(ForStatement const& _node) bool ASTJsonExporter::visit(ForStatement const& _node)
{ {
setJsonNode(_node, "ForStatement", {
std::vector<std::pair<std::string, Json::Value>> attributes = {
std::make_pair("initializationExpression", toJsonOrNull(_node.initializationExpression())), std::make_pair("initializationExpression", toJsonOrNull(_node.initializationExpression())),
std::make_pair("condition", toJsonOrNull(_node.condition())), std::make_pair("condition", toJsonOrNull(_node.condition())),
std::make_pair("loopExpression", toJsonOrNull(_node.loopExpression())), std::make_pair("loopExpression", toJsonOrNull(_node.loopExpression())),
std::make_pair("body", toJson(_node.body())) std::make_pair("body", toJson(_node.body()))
}); };
if (_node.annotation().isSimpleCounterLoop.set())
attributes.emplace_back(std::make_pair("isSimpleCounterLoop", *_node.annotation().isSimpleCounterLoop));
setJsonNode(_node, "ForStatement", std::move(attributes));
return false; return false;
} }

View File

@ -1245,7 +1245,16 @@ bool ContractCompiler::visit(ForStatement const& _forStatement)
// for's loop expression if existing // for's loop expression if existing
if (_forStatement.loopExpression()) if (_forStatement.loopExpression())
{
Arithmetic previousArithmetic = m_context.arithmetic();
if (
*_forStatement.annotation().isSimpleCounterLoop &&
m_optimiserSettings != OptimiserSettings::none()
)
m_context.setArithmetic(Arithmetic::Wrapping);
_forStatement.loopExpression()->accept(*this); _forStatement.loopExpression()->accept(*this);
m_context.setArithmetic(previousArithmetic);
}
m_context.appendJumpTo(loopStart); m_context.appendJumpTo(loopStart);

View File

@ -224,7 +224,7 @@ std::string IRGenerator::generate(
std::string IRGenerator::generate(Block const& _block) std::string IRGenerator::generate(Block const& _block)
{ {
IRGeneratorForStatements generator(m_context, m_utils); IRGeneratorForStatements generator(m_context, m_utils, m_optimiserSettings);
generator.generate(_block); generator.generate(_block);
return generator.code(); return generator.code();
} }
@ -447,7 +447,7 @@ std::string IRGenerator::generateModifier(
(!_modifierInvocation.arguments() || _modifierInvocation.arguments()->empty()), (!_modifierInvocation.arguments() || _modifierInvocation.arguments()->empty()),
"" ""
); );
IRGeneratorForStatements expressionEvaluator(m_context, m_utils); IRGeneratorForStatements expressionEvaluator(m_context, m_utils, m_optimiserSettings);
if (_modifierInvocation.arguments()) if (_modifierInvocation.arguments())
for (size_t i = 0; i < _modifierInvocation.arguments()->size(); i++) for (size_t i = 0; i < _modifierInvocation.arguments()->size(); i++)
{ {
@ -462,7 +462,7 @@ std::string IRGenerator::generateModifier(
} }
t("evalArgs", expressionEvaluator.code()); t("evalArgs", expressionEvaluator.code());
IRGeneratorForStatements generator(m_context, m_utils, [&]() { IRGeneratorForStatements generator(m_context, m_utils, m_optimiserSettings, [&]() {
std::string ret = joinHumanReadable(retParams); std::string ret = joinHumanReadable(retParams);
return return
(ret.empty() ? "" : ret + " := ") + (ret.empty() ? "" : ret + " := ") +
@ -572,7 +572,7 @@ std::string IRGenerator::generateGetter(VariableDeclaration const& _varDecl)
dispenseLocationComment(m_context.mostDerivedContract()) dispenseLocationComment(m_context.mostDerivedContract())
) )
("functionName", functionName) ("functionName", functionName)
("constantValueFunction", IRGeneratorForStatements(m_context, m_utils).constantValueFunction(_varDecl)) ("constantValueFunction", IRGeneratorForStatements(m_context, m_utils, m_optimiserSettings).constantValueFunction(_varDecl))
("ret", suffixedVariableNameList("ret_", 0, _varDecl.type()->sizeOnStack())) ("ret", suffixedVariableNameList("ret_", 0, _varDecl.type()->sizeOnStack()))
.render(); .render();
} }
@ -747,7 +747,7 @@ std::string IRGenerator::generateExternalFunction(ContractDefinition const& _con
std::string IRGenerator::generateInitialAssignment(VariableDeclaration const& _varDecl) std::string IRGenerator::generateInitialAssignment(VariableDeclaration const& _varDecl)
{ {
IRGeneratorForStatements generator(m_context, m_utils); IRGeneratorForStatements generator(m_context, m_utils, m_optimiserSettings);
generator.initializeLocalVar(_varDecl); generator.initializeLocalVar(_varDecl);
return generator.code(); return generator.code();
} }
@ -796,7 +796,7 @@ std::pair<std::string, std::map<ContractDefinition const*, std::vector<std::stri
modifier->arguments() modifier->arguments()
).second, ""); ).second, "");
IRGeneratorForStatements generator{m_context, m_utils}; IRGeneratorForStatements generator{m_context, m_utils, m_optimiserSettings};
for (auto&& [baseContract, arguments]: baseConstructorArguments) for (auto&& [baseContract, arguments]: baseConstructorArguments)
{ {
solAssert(baseContract && arguments, ""); solAssert(baseContract && arguments, "");
@ -817,7 +817,7 @@ std::pair<std::string, std::map<ContractDefinition const*, std::vector<std::stri
std::string IRGenerator::initStateVariables(ContractDefinition const& _contract) std::string IRGenerator::initStateVariables(ContractDefinition const& _contract)
{ {
IRGeneratorForStatements generator{m_context, m_utils}; IRGeneratorForStatements generator{m_context, m_utils, m_optimiserSettings};
for (VariableDeclaration const* variable: _contract.stateVariables()) for (VariableDeclaration const* variable: _contract.stateVariables())
if (!variable->isConstant()) if (!variable->isConstant())
generator.initializeStateVar(*variable); generator.initializeStateVar(*variable);

View File

@ -27,6 +27,7 @@
#include <libsolidity/ast/CallGraph.h> #include <libsolidity/ast/CallGraph.h>
#include <libsolidity/codegen/ir/IRGenerationContext.h> #include <libsolidity/codegen/ir/IRGenerationContext.h>
#include <libsolidity/codegen/YulUtilFunctions.h> #include <libsolidity/codegen/YulUtilFunctions.h>
#include <libsolidity/interface/OptimiserSettings.h>
#include <liblangutil/CharStreamProvider.h> #include <liblangutil/CharStreamProvider.h>
#include <liblangutil/EVMVersion.h> #include <liblangutil/EVMVersion.h>
@ -51,7 +52,8 @@ public:
RevertStrings _revertStrings, RevertStrings _revertStrings,
std::map<std::string, unsigned> _sourceIndices, std::map<std::string, unsigned> _sourceIndices,
langutil::DebugInfoSelection const& _debugInfoSelection, langutil::DebugInfoSelection const& _debugInfoSelection,
langutil::CharStreamProvider const* _soliditySourceProvider langutil::CharStreamProvider const* _soliditySourceProvider,
OptimiserSettings& _optimiserSettings
): ):
m_evmVersion(_evmVersion), m_evmVersion(_evmVersion),
m_eofVersion(_eofVersion), m_eofVersion(_eofVersion),
@ -63,7 +65,8 @@ public:
_debugInfoSelection, _debugInfoSelection,
_soliditySourceProvider _soliditySourceProvider
), ),
m_utils(_evmVersion, m_context.revertStrings(), m_context.functionCollector()) m_utils(_evmVersion, m_context.revertStrings(), m_context.functionCollector()),
m_optimiserSettings(_optimiserSettings)
{} {}
/// Generates and returns (unoptimized) IR code. /// Generates and returns (unoptimized) IR code.
@ -141,6 +144,7 @@ private:
IRGenerationContext m_context; IRGenerationContext m_context;
YulUtilFunctions m_utils; YulUtilFunctions m_utils;
OptimiserSettings m_optimiserSettings;
}; };
} }

View File

@ -352,7 +352,7 @@ std::string IRGeneratorForStatements::constantValueFunction(VariableDeclaration
)"); )");
templ("sourceLocationComment", dispenseLocationComment(_constant, m_context)); templ("sourceLocationComment", dispenseLocationComment(_constant, m_context));
templ("functionName", functionName); templ("functionName", functionName);
IRGeneratorForStatements generator(m_context, m_utils); IRGeneratorForStatements generator(m_context, m_utils, m_optimiserSettings);
solAssert(_constant.value()); solAssert(_constant.value());
Type const& constantType = *_constant.type(); Type const& constantType = *_constant.type();
templ("value", generator.evaluateExpression(*_constant.value(), constantType).commaSeparatedList()); templ("value", generator.evaluateExpression(*_constant.value(), constantType).commaSeparatedList());
@ -617,7 +617,9 @@ bool IRGeneratorForStatements::visit(ForStatement const& _forStatement)
_forStatement.body(), _forStatement.body(),
_forStatement.condition(), _forStatement.condition(),
_forStatement.initializationExpression(), _forStatement.initializationExpression(),
_forStatement.loopExpression() _forStatement.loopExpression(),
false, // _isDoWhile
*_forStatement.annotation().isSimpleCounterLoop
); );
return false; return false;
@ -3192,7 +3194,8 @@ void IRGeneratorForStatements::generateLoop(
Expression const* _conditionExpression, Expression const* _conditionExpression,
Statement const* _initExpression, Statement const* _initExpression,
ExpressionStatement const* _loopExpression, ExpressionStatement const* _loopExpression,
bool _isDoWhile bool _isDoWhile,
bool _isSimpleCounterLoop
) )
{ {
std::string firstRun; std::string firstRun;
@ -3209,7 +3212,13 @@ void IRGeneratorForStatements::generateLoop(
_initExpression->accept(*this); _initExpression->accept(*this);
appendCode() << "} 1 {\n"; appendCode() << "} 1 {\n";
if (_loopExpression) if (_loopExpression)
{
Arithmetic previousArithmetic = m_context.arithmetic();
if (m_optimiserSettings != OptimiserSettings::none() && _isSimpleCounterLoop)
m_context.setArithmetic(Arithmetic::Wrapping);
_loopExpression->accept(*this); _loopExpression->accept(*this);
m_context.setArithmetic(previousArithmetic);
}
appendCode() << "}\n"; appendCode() << "}\n";
appendCode() << "{\n"; appendCode() << "{\n";

View File

@ -24,6 +24,7 @@
#include <libsolidity/ast/ASTVisitor.h> #include <libsolidity/ast/ASTVisitor.h>
#include <libsolidity/codegen/ir/IRLValue.h> #include <libsolidity/codegen/ir/IRLValue.h>
#include <libsolidity/codegen/ir/IRVariable.h> #include <libsolidity/codegen/ir/IRVariable.h>
#include <libsolidity/interface/OptimiserSettings.h>
#include <functional> #include <functional>
@ -65,11 +66,13 @@ public:
IRGeneratorForStatements( IRGeneratorForStatements(
IRGenerationContext& _context, IRGenerationContext& _context,
YulUtilFunctions& _utils, YulUtilFunctions& _utils,
OptimiserSettings& _optimiserSettings,
std::function<std::string()> _placeholderCallback = {} std::function<std::string()> _placeholderCallback = {}
): ):
IRGeneratorForStatementsBase(_context), IRGeneratorForStatementsBase(_context),
m_placeholderCallback(std::move(_placeholderCallback)), m_placeholderCallback(std::move(_placeholderCallback)),
m_utils(_utils) m_utils(_utils),
m_optimiserSettings(_optimiserSettings)
{} {}
std::string code() const override; std::string code() const override;
@ -235,7 +238,8 @@ private:
Expression const* _conditionExpression, Expression const* _conditionExpression,
Statement const* _initExpression = nullptr, Statement const* _initExpression = nullptr,
ExpressionStatement const* _loopExpression = nullptr, ExpressionStatement const* _loopExpression = nullptr,
bool _isDoWhile = false bool _isDoWhile = false,
bool _isSimpleCounterLoop = false
); );
static Type const& type(Expression const& _expression); static Type const& type(Expression const& _expression);
@ -245,6 +249,7 @@ private:
std::function<std::string()> m_placeholderCallback; std::function<std::string()> m_placeholderCallback;
YulUtilFunctions& m_utils; YulUtilFunctions& m_utils;
std::optional<IRLValue> m_currentLValue; std::optional<IRLValue> m_currentLValue;
OptimiserSettings m_optimiserSettings;
}; };
} }

View File

@ -1498,7 +1498,8 @@ void CompilerStack::generateIR(ContractDefinition const& _contract)
m_revertStrings, m_revertStrings,
sourceIndices(), sourceIndices(),
m_debugInfoSelection, m_debugInfoSelection,
this this,
m_optimiserSettings
); );
compiledContract.yulIR = generator.run( compiledContract.yulIR = generator.run(
_contract, _contract,

View File

@ -123,6 +123,11 @@ struct OptimiserSettings
expectedExecutionsPerDeployment == _other.expectedExecutionsPerDeployment; expectedExecutionsPerDeployment == _other.expectedExecutionsPerDeployment;
} }
bool operator!=(OptimiserSettings const& _other) const
{
return !(*this == _other);
}
/// Move literals to the right of commutative binary operators during code generation. /// Move literals to the right of commutative binary operators during code generation.
/// This helps exploiting associativity. /// This helps exploiting associativity.
bool runOrderLiterals = false; bool runOrderLiterals = false;

View File

@ -34,15 +34,8 @@ object "Arraysum_34" {
/** @src 0:380:397 "i < values.length" */ lt(var_i, _2) /** @src 0:380:397 "i < values.length" */ lt(var_i, _2)
/// @src 0:368:378 "uint i = 0" /// @src 0:368:378 "uint i = 0"
{ {
/// @src 0:80:429 "contract Arraysum {..."
if eq(var_i, not(0))
{
mstore(0, shl(224, 0x4e487b71))
mstore(_1, 0x11)
revert(0, 0x24)
}
/// @src 0:399:402 "i++" /// @src 0:399:402 "i++"
var_i := /** @src 0:80:429 "contract Arraysum {..." */ add(var_i, 1) var_i := /** @src 0:80:429 "contract Arraysum {..." */ add(/** @src 0:399:402 "i++" */ var_i, /** @src 0:80:429 "contract Arraysum {..." */ 1)
} }
/// @src 0:399:402 "i++" /// @src 0:399:402 "i++"
{ {

View File

@ -283,6 +283,7 @@
"nodeType": "VariableDeclarationStatement", "nodeType": "VariableDeclarationStatement",
"src": "212:10:1" "src": "212:10:1"
}, },
"isSimpleCounterLoop": true,
"loopExpression": "loopExpression":
{ {
"expression": "expression":

View File

@ -21,4 +21,5 @@ contract C {
uint param3 uint param3
) public {} ) public {}
} }
// ---- // ----

View File

@ -244,6 +244,7 @@
"nodeType": "VariableDeclarationStatement", "nodeType": "VariableDeclarationStatement",
"src": "131:10:1" "src": "131:10:1"
}, },
"isSimpleCounterLoop": true,
"loopExpression": "loopExpression":
{ {
"expression": "expression":

View File

@ -12,4 +12,5 @@ contract C {
return x; return x;
} }
} }
// ---- // ----

View File

@ -253,6 +253,7 @@
"nodeType": "VariableDeclarationStatement", "nodeType": "VariableDeclarationStatement",
"src": "117:10:1" "src": "117:10:1"
}, },
"isSimpleCounterLoop": true,
"loopExpression": "loopExpression":
{ {
"expression": "expression":

View File

@ -12,4 +12,5 @@ contract C {
return x; return x;
} }
} }
// ---- // ----

View File

@ -0,0 +1,180 @@
type UINT is uint;
function add(UINT x, UINT y) pure returns (UINT) {
return UINT.wrap(UINT.unwrap(x) + UINT.unwrap(y));
}
function lt(UINT x, UINT y) pure returns (bool) {
return UINT.unwrap(x) < UINT.unwrap(y);
}
using {lt as <, add as +} for UINT global;
function g() pure returns (bool) {
return false;
}
function h() pure returns (uint) {
return 13;
}
contract C {
uint[] dynArray;
uint z = 0;
function modifyStateVarZ() public returns (uint) {
z = type(uint).max;
return z;
}
function f() public {
// Positive Cases
/// SimplePreIncrement: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) {
}
/// SimplePosIncrement: isSimpleCounterLoop
for(int i = 0; i < 42; i++) {
}
uint x;
/// CounterReadLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; i++) {
x = i;
}
/// LocalVarConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < x; i++) {
}
uint[8] memory array;
/// StaticArrayLengthConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < array.length; i++) {
}
dynArray.push();
/// DynamicArrayLengthConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < dynArray.length; i++) {
dynArray.push(i);
}
/// CounterReadInlineAssembly: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) {
assembly {
x := i
}
}
/// BinaryOperationConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < i + 1; i++) {
}
/// FreeFunctionConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < h(); ++i) {
}
// Negative Cases
/// AdditionLoopExpression: isSimpleCounterLoop
for(uint i = 0; i < 42; i = i + 1) {
}
/// SimplePreDecrement: isSimpleCounterLoop
for(uint i = 42; i > 0; --i) {
}
/// SimplePosDecrement: isSimpleCounterLoop
for(uint i = 42; i > 0; i--) {
}
/// MultiplicationLoopExpression: isSimpleCounterLoop
for(uint i = 1; i < 42; i = i * 2) {
}
/// CounterIncrementLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) {
i++;
}
/// CounterAssignmentLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) {
i = 43;
}
/// CounterAssignmentInlineAssemblyLoopBody: isSimpleCounterLoop
for(uint i = 0; i < 42; ++i) {
assembly {
i := add(i, 1)
}
}
uint j = type(uint).max;
/// ExternalCounterLoopExpression: isSimpleCounterLoop
for (uint i = 0; i < 10; ++j) {
}
/// CounterIncrementRHSAssignment: isSimpleCounterLoop
for(uint i = 0; i < 10; ++i) {
x = i++;
}
/// NoEffectLoopExpression: isSimpleCounterLoop
for(uint i = 0; i < 42; i) {
}
/// EmptyLoopExpression: isSimpleCounterLoop
for(uint i = 0; i < 10; ) {
}
uint y = type(uint8).max + 1;
/// DifferentCommonTypeCondition: isSimpleCounterLoop
for(uint8 i = 0; i < y; ++i) {
}
/// LessThanOrEqualCondition: isSimpleCounterLoop
for(uint i = 0; i <= 10; ++i) {
}
/// ComplexExpressionCondition: isSimpleCounterLoop
for(uint i = 0; (i < 10 || g()); ++i) {
}
/// FreeFunctionConditionLHS: isSimpleCounterLoop
for(uint i = 0; h() < 100; ++i) {
}
/// FreeFunctionConditionDifferentCommonTypeLHS: isSimpleCounterLoop
for(uint8 i = 0; i < h(); ++i) {
}
/// NonIntegerTypeCondition: isSimpleCounterLoop
for(uint i = 0; address(this) < msg.sender; ++i) {
}
/// UDVTOperators: isSimpleCounterLoop
for(UINT i = UINT.wrap(0); i < UINT.wrap(10); i = i + UINT.wrap(1)) {
}
/// CounterAssignmentConditionRHS: isSimpleCounterLoop
for(uint i = 0; i < (i = i + 1); ++i) {
}
/// LiteralDifferentCommonTypeConditionRHS: isSimpleCounterLoop
for(uint8 i = 0; i < 257 ; ++i) {
}
/// StateVarCounterModifiedFunctionConditionRHS: isSimpleCounterLoop
for (z = 1; z < modifyStateVarZ(); ++z) {
}
/// StateVarCounterModifiedFunctionLoopBody: isSimpleCounterLoop
for (z = 1; z < 2048; ++z) {
modifyStateVarZ();
}
/// NonIntegerCounter: isSimpleCounterLoop
for (address i = address(0x123); i < address(this); i = address(0x123 + 1)) {
}
}
}
// ----
// SimplePreIncrement: true
// SimplePosIncrement: true
// CounterReadLoopBody: true
// LocalVarConditionRHS: true
// StaticArrayLengthConditionRHS: true
// DynamicArrayLengthConditionRHS: true
// CounterReadInlineAssembly: true
// BinaryOperationConditionRHS: true
// FreeFunctionConditionRHS: true
// AdditionLoopExpression: false
// SimplePreDecrement: false
// SimplePosDecrement: false
// MultiplicationLoopExpression: false
// CounterIncrementLoopBody: false
// CounterAssignmentLoopBody: false
// CounterAssignmentInlineAssemblyLoopBody: false
// ExternalCounterLoopExpression: false
// CounterIncrementRHSAssignment: false
// NoEffectLoopExpression: false
// DifferentCommonTypeCondition: false
// EmptyLoopExpression: false
// LessThanOrEqualCondition: false
// ComplexExpressionCondition: false
// FreeFunctionConditionLHS: false
// FreeFunctionConditionDifferentCommonTypeLHS: false
// NonIntegerTypeCondition: false
// UDVTOperators: false
// CounterAssignmentConditionRHS: true
// LiteralDifferentCommonTypeConditionRHS: false
// StateVarCounterModifiedFunctionConditionRHS: true
// StateVarCounterModifiedFunctionLoopBody: true
// NonIntegerCounter: false

View File

@ -59,10 +59,10 @@ contract C {
// EVMVersion: >homestead // EVMVersion: >homestead
// ---- // ----
// test_bytes() -> // test_bytes() ->
// gas irOptimized: 360863 // gas irOptimized: 321332
// gas legacy: 411269 // gas legacy: 319111
// gas legacyOptimized: 317754 // gas legacyOptimized: 269317
// test_uint256() -> // test_uint256() ->
// gas irOptimized: 509677 // gas irOptimized: 447844
// gas legacy: 577469 // gas legacy: 433627
// gas legacyOptimized: 441003 // gas legacyOptimized: 365410

View File

@ -60,10 +60,10 @@ contract C {
// EVMVersion: >homestead // EVMVersion: >homestead
// ---- // ----
// test_bytes() -> // test_bytes() ->
// gas irOptimized: 360863 // gas irOptimized: 321332
// gas legacy: 411269 // gas legacy: 319111
// gas legacyOptimized: 317754 // gas legacyOptimized: 269317
// test_uint256() -> // test_uint256() ->
// gas irOptimized: 509677 // gas irOptimized: 447844
// gas legacy: 577469 // gas legacy: 433627
// gas legacyOptimized: 441003 // gas legacyOptimized: 365410

View File

@ -20,6 +20,6 @@ contract C {
// f(uint256[][1]): 32, 32, 0 -> true // f(uint256[][1]): 32, 32, 0 -> true
// f(uint256[][1]): 32, 32, 1, 42 -> true // f(uint256[][1]): 32, 32, 1, 42 -> true
// f(uint256[][1]): 32, 32, 8, 421, 422, 423, 424, 425, 426, 427, 428 -> true // f(uint256[][1]): 32, 32, 8, 421, 422, 423, 424, 425, 426, 427, 428 -> true
// gas irOptimized: 126851 // gas irOptimized: 120043
// gas legacy: 139800 // gas legacy: 101568
// gas legacyOptimized: 119092 // gas legacyOptimized: 119092

View File

@ -26,9 +26,9 @@ contract C {
// index(uint256): 10 -> true // index(uint256): 10 -> true
// index(uint256): 20 -> true // index(uint256): 20 -> true
// index(uint256): 0xFF -> true // index(uint256): 0xFF -> true
// gas irOptimized: 135066 // gas irOptimized: 108291
// gas legacy: 241703 // gas legacy: 181523
// gas legacyOptimized: 151613 // gas legacyOptimized: 117443
// accessIndex(uint256,int256): 10, 1 -> 2 // accessIndex(uint256,int256): 10, 1 -> 2
// accessIndex(uint256,int256): 10, 0 -> 1 // accessIndex(uint256,int256): 10, 0 -> 1
// accessIndex(uint256,int256): 10, 11 -> FAILURE, hex"4e487b71", 0x32 // accessIndex(uint256,int256): 10, 11 -> FAILURE, hex"4e487b71", 0x32

View File

@ -16,38 +16,38 @@ contract C {
// ---- // ----
// test_indices(uint256): 1 -> // test_indices(uint256): 1 ->
// test_indices(uint256): 129 -> // test_indices(uint256): 129 ->
// gas irOptimized: 3016570 // gas irOptimized: 3003025
// gas legacy: 3069098 // gas legacy: 3038654
// gas legacyOptimized: 3013250 // gas legacyOptimized: 2995964
// test_indices(uint256): 5 -> // test_indices(uint256): 5 ->
// gas irOptimized: 576716 // gas irOptimized: 576296
// gas legacy: 574754 // gas legacy: 573810
// gas legacyOptimized: 572383 // gas legacyOptimized: 571847
// test_indices(uint256): 10 -> // test_indices(uint256): 10 ->
// gas irOptimized: 158059 // gas irOptimized: 157009
// gas legacy: 162468 // gas legacy: 160108
// gas legacyOptimized: 158336 // gas legacyOptimized: 156996
// test_indices(uint256): 15 -> // test_indices(uint256): 15 ->
// gas irOptimized: 172984 // gas irOptimized: 171409
// gas legacy: 179513 // gas legacy: 175973
// gas legacyOptimized: 173606 // gas legacyOptimized: 171596
// test_indices(uint256): 0xFF -> // test_indices(uint256): 0xFF ->
// gas irOptimized: 5672104 // gas irOptimized: 5645329
// gas legacy: 5775928 // gas legacy: 5715748
// gas legacyOptimized: 5666726 // gas legacyOptimized: 5632556
// test_indices(uint256): 1000 -> // test_indices(uint256): 1000 ->
// gas irOptimized: 18173701 // gas irOptimized: 18068701
// gas legacy: 18583810 // gas legacy: 18347810
// gas legacyOptimized: 18171248 // gas legacyOptimized: 18037248
// test_indices(uint256): 129 -> // test_indices(uint256): 129 ->
// gas irOptimized: 4147676 // gas irOptimized: 4136840
// gas legacy: 4164468 // gas legacy: 4140113
// gas legacyOptimized: 4122100 // gas legacyOptimized: 4108272
// test_indices(uint256): 128 -> // test_indices(uint256): 128 ->
// gas irOptimized: 409209 // gas irOptimized: 395769
// gas legacy: 463706 // gas legacy: 433498
// gas legacyOptimized: 418061 // gas legacyOptimized: 400909
// test_indices(uint256): 1 -> // test_indices(uint256): 1 ->
// gas irOptimized: 580316 // gas irOptimized: 580232
// gas legacy: 576904 // gas legacy: 576715
// gas legacyOptimized: 575649 // gas legacyOptimized: 575542

View File

@ -52,18 +52,18 @@ contract C {
// ---- // ----
// test_zeroed_indicies(uint256): 1 -> // test_zeroed_indicies(uint256): 1 ->
// test_zeroed_indicies(uint256): 5 -> // test_zeroed_indicies(uint256): 5 ->
// gas irOptimized: 131809 // gas irOptimized: 131315
// gas legacy: 132804 // gas legacy: 131671
// gas legacyOptimized: 130649 // gas legacyOptimized: 129994
// test_zeroed_indicies(uint256): 10 -> // test_zeroed_indicies(uint256): 10 ->
// gas irOptimized: 225696 // gas irOptimized: 224578
// gas legacy: 227786 // gas legacy: 225237
// gas legacyOptimized: 223830 // gas legacyOptimized: 222359
// test_zeroed_indicies(uint256): 15 -> // test_zeroed_indicies(uint256): 15 ->
// gas irOptimized: 323704 // gas irOptimized: 321962
// gas legacy: 326902 // gas legacy: 322937
// gas legacyOptimized: 321206 // gas legacyOptimized: 318919
// test_zeroed_indicies(uint256): 0xFF -> // test_zeroed_indicies(uint256): 0xFF ->
// gas irOptimized: 5112500 // gas irOptimized: 5080806
// gas legacy: 5165874 // gas legacy: 5093941
// gas legacyOptimized: 5062182 // gas legacyOptimized: 5020727

View File

@ -12,13 +12,13 @@ contract C {
// EVMVersion: >=petersburg // EVMVersion: >=petersburg
// ---- // ----
// pushEmpty(uint256): 128 // pushEmpty(uint256): 128
// gas irOptimized: 404095 // gas irOptimized: 401024
// gas legacy: 415744 // gas legacy: 400640
// gas legacyOptimized: 397380 // gas legacyOptimized: 388804
// pushEmpty(uint256): 256 // pushEmpty(uint256): 256
// gas irOptimized: 689843 // gas irOptimized: 683700
// gas legacy: 715316 // gas legacy: 685108
// gas legacyOptimized: 688632 // gas legacyOptimized: 671480
// pushEmpty(uint256): 38869 -> FAILURE # out-of-gas # // pushEmpty(uint256): 38869 -> FAILURE # out-of-gas #
// gas irOptimized: 100000000 // gas irOptimized: 100000000
// gas legacy: 100000000 // gas legacy: 100000000

View File

@ -46,8 +46,8 @@ contract c {
// storageEmpty -> 0 // storageEmpty -> 0
// test_long() -> 67 // test_long() -> 67
// gas irOptimized: 89148 // gas irOptimized: 89148
// gas legacy: 105693 // gas legacy: 101601
// gas legacyOptimized: 103216 // gas legacyOptimized: 100477
// storageEmpty -> 0 // storageEmpty -> 0
// test_pop() -> 1780731860627700044960722568376592200742329637303199754547598369979433020 // test_pop() -> 1780731860627700044960722568376592200742329637303199754547598369979433020
// gas legacy: 61930 // gas legacy: 61930

View File

@ -17,6 +17,6 @@ contract c {
} }
// ---- // ----
// test() -> 0 // test() -> 0
// gas irOptimized: 125058 // gas irOptimized: 123560
// gas legacy: 150372 // gas legacy: 147098
// gas legacyOptimized: 146391 // gas legacyOptimized: 144200

View File

@ -18,6 +18,6 @@ contract c {
} }
// ---- // ----
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000 // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x05000000000000000000000000000000000000000000000000
// gas irOptimized: 208074 // gas irOptimized: 207889
// gas legacy: 221769 // gas legacy: 220707
// gas legacyOptimized: 220611 // gas legacyOptimized: 220098

View File

@ -35,12 +35,12 @@ contract c {
} }
// ---- // ----
// test() -> 0x02000202 // test() -> 0x02000202
// gas irOptimized: 4548150 // gas irOptimized: 4547793
// gas legacy: 4476222 // gas legacy: 4475396
// gas legacyOptimized: 4448113 // gas legacyOptimized: 4447665
// storageEmpty -> 1 // storageEmpty -> 1
// clear() -> 0, 0 // clear() -> 0, 0
// gas irOptimized: 4475134 // gas irOptimized: 4474777
// gas legacy: 4408014 // gas legacy: 4407188
// gas legacyOptimized: 4381784 // gas legacyOptimized: 4381336
// storageEmpty -> 1 // storageEmpty -> 1

View File

@ -17,6 +17,6 @@ contract c {
} }
// ---- // ----
// test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000 // test() -> 0xffffffff, 0x0000000000000000000000000a00090008000700060005000400030002000100, 0x0000000000000000000000000000000000000000000000000000000000000000
// gas irOptimized: 104526 // gas irOptimized: 100980
// gas legacy: 166874 // gas legacy: 158142
// gas legacyOptimized: 145474 // gas legacyOptimized: 141096

View File

@ -18,6 +18,6 @@ contract c {
} }
// ---- // ----
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0 // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x0
// gas irOptimized: 273563 // gas irOptimized: 273372
// gas legacy: 283666 // gas legacy: 282604
// gas legacyOptimized: 282023 // gas legacyOptimized: 281510

View File

@ -18,6 +18,6 @@ contract c {
} }
// ---- // ----
// test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x00 // test() -> 0x01000000000000000000000000000000000000000000000000, 0x02000000000000000000000000000000000000000000000000, 0x03000000000000000000000000000000000000000000000000, 0x04000000000000000000000000000000000000000000000000, 0x00
// gas irOptimized: 233255 // gas irOptimized: 233118
// gas legacy: 236523 // gas legacy: 235697
// gas legacyOptimized: 235592 // gas legacyOptimized: 235193

View File

@ -23,4 +23,4 @@ contract C {
// compileViaYul: true // compileViaYul: true
// ---- // ----
// f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1 // f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1
// gas irOptimized: 327383 // gas irOptimized: 326771

View File

@ -17,25 +17,25 @@ contract c {
// ---- // ----
// f(uint256): 0 -> 0x20, 0x00 // f(uint256): 0 -> 0x20, 0x00
// f(uint256): 31 -> 0x20, 0x1f, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e00 // f(uint256): 31 -> 0x20, 0x1f, 0x0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e00
// gas irOptimized: 109219 // gas irOptimized: 104476
// gas legacy: 123948 // gas legacy: 112974
// gas legacyOptimized: 118948 // gas legacyOptimized: 112717
// f(uint256): 32 -> 0x20, 0x20, 1780731860627700044960722568376592200742329637303199754547598369979440671 // f(uint256): 32 -> 0x20, 0x20, 1780731860627700044960722568376592200742329637303199754547598369979440671
// gas irOptimized: 123858 // gas irOptimized: 118962
// gas legacy: 140362 // gas legacy: 129034
// gas legacyOptimized: 135384 // gas legacyOptimized: 128952
// f(uint256): 33 -> 0x20, 33, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x2000000000000000000000000000000000000000000000000000000000000000 // f(uint256): 33 -> 0x20, 33, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x2000000000000000000000000000000000000000000000000000000000000000
// gas irOptimized: 130468 // gas irOptimized: 125419
// gas legacy: 147916 // gas legacy: 136234
// gas legacyOptimized: 142276 // gas legacyOptimized: 135643
// f(uint256): 63 -> 0x20, 0x3f, 1780731860627700044960722568376592200742329637303199754547598369979440671, 14532552714582660066924456880521368950258152170031413196862950297402215316992 // f(uint256): 63 -> 0x20, 0x3f, 1780731860627700044960722568376592200742329637303199754547598369979440671, 14532552714582660066924456880521368950258152170031413196862950297402215316992
// gas irOptimized: 139168 // gas irOptimized: 129529
// gas legacy: 171136 // gas legacy: 148834
// gas legacyOptimized: 161536 // gas legacyOptimized: 148873
// f(uint256): 12 -> 0x20, 0x0c, 0x0102030405060708090a0b0000000000000000000000000000000000000000 // f(uint256): 12 -> 0x20, 0x0c, 0x0102030405060708090a0b0000000000000000000000000000000000000000
// gas legacy: 59345 // gas legacy: 59345
// gas legacyOptimized: 57279 // gas legacyOptimized: 57279
// f(uint256): 129 -> 0x20, 0x81, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f, 29063324697304692433803953038474361308315562010425523193971352996434451193439, 0x606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f, -57896044618658097711785492504343953926634992332820282019728792003956564819968 // f(uint256): 129 -> 0x20, 0x81, 1780731860627700044960722568376592200742329637303199754547598369979440671, 0x202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f, 29063324697304692433803953038474361308315562010425523193971352996434451193439, 0x606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e7f, -57896044618658097711785492504343953926634992332820282019728792003956564819968
// gas irOptimized: 441648 // gas irOptimized: 421911
// gas legacy: 505021 // gas legacy: 459355
// gas legacyOptimized: 486995 // gas legacyOptimized: 461066

View File

@ -18,6 +18,6 @@ contract C {
} }
// ---- // ----
// f() -> 3 // f() -> 3
// gas irOptimized: 128094 // gas irOptimized: 127422
// gas legacy: 130584 // gas legacy: 129050
// gas legacyOptimized: 129028 // gas legacyOptimized: 128222

View File

@ -17,6 +17,6 @@ contract C {
} }
// ---- // ----
// f() -> 1, 2, 3, 4, 5, 6, 7 // f() -> 1, 2, 3, 4, 5, 6, 7
// gas irOptimized: 205879 // gas irOptimized: 205783
// gas legacy: 212237 // gas legacy: 211765
// gas legacyOptimized: 211425 // gas legacyOptimized: 211181

View File

@ -18,6 +18,6 @@ contract C {
} }
// ---- // ----
// f() -> 1, 2, 3, 4, 5, 6, 7 // f() -> 1, 2, 3, 4, 5, 6, 7
// gas irOptimized: 205879 // gas irOptimized: 205783
// gas legacy: 212242 // gas legacy: 211770
// gas legacyOptimized: 211430 // gas legacyOptimized: 211186

View File

@ -13,6 +13,6 @@ contract C {
} }
// ---- // ----
// f() -> 2, 3, 4 // f() -> 2, 3, 4
// gas irOptimized: 109702 // gas irOptimized: 109108
// gas legacy: 126129 // gas legacy: 122235
// gas legacyOptimized: 120622 // gas legacyOptimized: 118411

View File

@ -16,6 +16,6 @@ contract c {
} }
// ---- // ----
// test1() -> true // test1() -> true
// gas irOptimized: 206388 // gas irOptimized: 204782
// gas legacy: 254056 // gas legacy: 242256
// gas legacyOptimized: 246892 // gas legacyOptimized: 241192

View File

@ -14,9 +14,9 @@ contract c {
// ---- // ----
// storageEmpty -> 1 // storageEmpty -> 1
// fill() -> // fill() ->
// gas irOptimized: 519266 // gas irOptimized: 519017
// gas legacy: 521414 // gas legacy: 518936
// gas legacyOptimized: 516983 // gas legacyOptimized: 515555
// storageEmpty -> 0 // storageEmpty -> 0
// halfClear() -> // halfClear() ->
// gas irOptimized: 113961 // gas irOptimized: 113961

View File

@ -10,9 +10,9 @@ contract c {
// ---- // ----
// storageEmpty -> 1 // storageEmpty -> 1
// fill() -> // fill() ->
// gas irOptimized: 465314 // gas irOptimized: 464834
// gas legacy: 471178 // gas legacy: 468818
// gas legacyOptimized: 467478 // gas legacyOptimized: 466238
// storageEmpty -> 0 // storageEmpty -> 0
// clear() -> // clear() ->
// gas irOptimized: 122148 // gas irOptimized: 122148

View File

@ -42,6 +42,6 @@ contract C {
} }
// ---- // ----
// test() -> 5, 6, 7 // test() -> 5, 6, 7
// gas irOptimized: 256288 // gas irOptimized: 255728
// gas legacy: 441556 // gas legacy: 440376
// gas legacyOptimized: 279321 // gas legacyOptimized: 278651

View File

@ -9,6 +9,6 @@ contract c {
} }
// ---- // ----
// test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000 // test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000
// gas irOptimized: 107962 // gas irOptimized: 107343
// gas legacy: 125420 // gas legacy: 121408
// gas legacyOptimized: 122472 // gas legacyOptimized: 120534

View File

@ -15,6 +15,6 @@ contract c {
} }
// ---- // ----
// test() -> 0 // test() -> 0
// gas irOptimized: 171996 // gas irOptimized: 167700
// gas legacy: 215891 // gas legacy: 206219
// gas legacyOptimized: 203615 // gas legacyOptimized: 197297

View File

@ -21,9 +21,9 @@ contract C {
// ---- // ----
// l() -> 0 // l() -> 0
// g(uint256): 70 -> // g(uint256): 70 ->
// gas irOptimized: 182328 // gas irOptimized: 180849
// gas legacy: 183445 // gas legacy: 175185
// gas legacyOptimized: 178995 // gas legacyOptimized: 175005
// l() -> 70 // l() -> 70
// a(uint256): 69 -> left(69) // a(uint256): 69 -> left(69)
// f() -> // f() ->

View File

@ -17,6 +17,6 @@ contract C {
// ---- // ----
// deposit() -> // deposit() ->
// ~ emit E(string,uint256[4]): #0xa7fb06bb999a5eb9aff9e0779953f4e1e4ce58044936c2f51c7fb879b85c08bd, #0xe755d8cc1a8cde16a2a31160dcd8017ac32d7e2f13215b29a23cdae40a78aa81 // ~ emit E(string,uint256[4]): #0xa7fb06bb999a5eb9aff9e0779953f4e1e4ce58044936c2f51c7fb879b85c08bd, #0xe755d8cc1a8cde16a2a31160dcd8017ac32d7e2f13215b29a23cdae40a78aa81
// gas irOptimized: 330920 // gas irOptimized: 328856
// gas legacy: 387608 // gas legacy: 365828
// gas legacyOptimized: 373771 // gas legacyOptimized: 362251

View File

@ -33,9 +33,9 @@ contract test {
// EVMVersion: >=constantinople // EVMVersion: >=constantinople
// ---- // ----
// constructor() // constructor()
// gas irOptimized: 406679 // gas irOptimized: 405844
// gas legacy: 737652 // gas legacy: 735054
// gas legacyOptimized: 527036 // gas legacyOptimized: 522722
// encode_inline_asm(bytes): 0x20, 0 -> 0x20, 0 // encode_inline_asm(bytes): 0x20, 0 -> 0x20, 0
// encode_inline_asm(bytes): 0x20, 1, "f" -> 0x20, 4, "Zg==" // encode_inline_asm(bytes): 0x20, 1, "f" -> 0x20, 4, "Zg=="
// encode_inline_asm(bytes): 0x20, 2, "fo" -> 0x20, 4, "Zm8=" // encode_inline_asm(bytes): 0x20, 2, "fo" -> 0x20, 4, "Zm8="
@ -51,10 +51,10 @@ contract test {
// encode_no_asm(bytes): 0x20, 5, "fooba" -> 0x20, 8, "Zm9vYmE=" // encode_no_asm(bytes): 0x20, 5, "fooba" -> 0x20, 8, "Zm9vYmE="
// encode_no_asm(bytes): 0x20, 6, "foobar" -> 0x20, 8, "Zm9vYmFy" // encode_no_asm(bytes): 0x20, 6, "foobar" -> 0x20, 8, "Zm9vYmFy"
// encode_inline_asm_large() // encode_inline_asm_large()
// gas irOptimized: 1373025 // gas irOptimized: 1322025
// gas legacy: 1672031 // gas legacy: 1554031
// gas legacyOptimized: 1199031 // gas legacyOptimized: 1132031
// encode_no_asm_large() // encode_no_asm_large()
// gas irOptimized: 3257081 // gas irOptimized: 3206081
// gas legacy: 4705075 // gas legacy: 4587075
// gas legacyOptimized: 2890075 // gas legacyOptimized: 2823075

View File

@ -176,35 +176,35 @@ contract DepositContract is IDepositContract, ERC165 {
} }
// ---- // ----
// constructor() // constructor()
// gas irOptimized: 1397699 // gas irOptimized: 1386886
// gas legacy: 2391952 // gas legacy: 2369061
// gas legacyOptimized: 1752320 // gas legacyOptimized: 1740144
// supportsInterface(bytes4): 0x0 -> 0 // supportsInterface(bytes4): 0x0 -> 0
// supportsInterface(bytes4): 0xffffffff00000000000000000000000000000000000000000000000000000000 -> false # defined to be false by ERC-165 # // supportsInterface(bytes4): 0xffffffff00000000000000000000000000000000000000000000000000000000 -> false # defined to be false by ERC-165 #
// supportsInterface(bytes4): 0x01ffc9a700000000000000000000000000000000000000000000000000000000 -> true # ERC-165 id # // supportsInterface(bytes4): 0x01ffc9a700000000000000000000000000000000000000000000000000000000 -> true # ERC-165 id #
// supportsInterface(bytes4): 0x8564090700000000000000000000000000000000000000000000000000000000 -> true # the deposit interface id # // supportsInterface(bytes4): 0x8564090700000000000000000000000000000000000000000000000000000000 -> true # the deposit interface id #
// get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e // get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e
// gas irOptimized: 116863 // gas irOptimized: 115231
// gas legacy: 151981 // gas legacy: 148205
// gas legacyOptimized: 124447 // gas legacyOptimized: 122303
// get_deposit_count() -> 0x20, 8, 0 # TODO: check balance and logs after each deposit # // 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 # // deposit(bytes,bytes,bytes,bytes32), 32 ether: 0 -> FAILURE # Empty input #
// get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e // get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e
// gas irOptimized: 116863 // gas irOptimized: 115231
// gas legacy: 151981 // gas legacy: 148205
// gas legacyOptimized: 124447 // gas legacyOptimized: 122303
// get_deposit_count() -> 0x20, 8, 0 // 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 # // 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 // ~ 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 // get_deposit_root() -> 0x2089653123d9c721215120b6db6738ba273bbc5228ac093b1f983badcdc8a438
// gas irOptimized: 116848 // gas irOptimized: 115216
// gas legacy: 151990 // gas legacy: 148214
// gas legacyOptimized: 124459 // gas legacyOptimized: 122315
// get_deposit_count() -> 0x20, 8, 0x0100000000000000000000000000000000000000000000000000000000000000 // 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 # // 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 // ~ 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 // get_deposit_root() -> 0x40255975859377d912c53aa853245ebd939bdd2b33a28e084babdcc1ed8238ee
// gas irOptimized: 116848 // gas irOptimized: 115216
// gas legacy: 151990 // gas legacy: 148214
// gas legacyOptimized: 124459 // gas legacyOptimized: 122315
// get_deposit_count() -> 0x20, 8, 0x0200000000000000000000000000000000000000000000000000000000000000 // get_deposit_count() -> 0x20, 8, 0x0200000000000000000000000000000000000000000000000000000000000000

View File

@ -48,9 +48,9 @@ contract test {
} }
// ---- // ----
// constructor() // constructor()
// gas irOptimized: 1847920 // gas irOptimized: 1841716
// gas legacy: 2430726 // gas legacy: 2414091
// gas legacyOptimized: 1854979 // gas legacyOptimized: 1847616
// div(int256,int256): 3141592653589793238, 88714123 -> 35412542528203691288251815328 // div(int256,int256): 3141592653589793238, 88714123 -> 35412542528203691288251815328
// gas irOptimized: 22137 // gas irOptimized: 22137
// gas legacy: 22767 // gas legacy: 22767

View File

@ -48,9 +48,9 @@ contract test {
} }
// ---- // ----
// constructor() // constructor()
// gas irOptimized: 1722598 // gas irOptimized: 1716771
// gas legacy: 2210160 // gas legacy: 2193550
// gas legacyOptimized: 1734152 // gas legacyOptimized: 1725061
// div(uint256,uint256): 3141592653589793238, 88714123 -> 35412542528203691288251815328 // div(uint256,uint256): 3141592653589793238, 88714123 -> 35412542528203691288251815328
// gas irOptimized: 22004 // gas irOptimized: 22004
// gas legacy: 22497 // gas legacy: 22497

View File

@ -33,10 +33,10 @@ contract test {
} }
// ---- // ----
// constructor() // constructor()
// gas irOptimized: 407075 // gas irOptimized: 407507
// gas legacy: 631753 // gas legacy: 615090
// gas legacyOptimized: 459425 // gas legacyOptimized: 451871
// prb_pi() -> 3141592656369545286 // prb_pi() -> 3141592656369545286
// gas irOptimized: 57478 // gas irOptimized: 57478
// gas legacy: 101655 // gas legacy: 100947
// gas legacyOptimized: 75735 // gas legacyOptimized: 75735

View File

@ -294,11 +294,11 @@ contract Test {
// f() -> true // f() -> true
// g() -> true // g() -> true
// pair() -> true // pair() -> true
// gas irOptimized: 269901 // gas irOptimized: 269697
// gas legacy: 275678 // gas legacy: 275206
// gas legacyOptimized: 267193 // gas legacyOptimized: 266925
// verifyTx() -> true // verifyTx() -> true
// ~ emit Verified(string): 0x20, 0x16, "Successfully verified." // ~ emit Verified(string): 0x20, 0x16, "Successfully verified."
// gas irOptimized: 783281 // gas irOptimized: 782210
// gas legacy: 804346 // gas legacy: 801868
// gas legacyOptimized: 772349 // gas legacyOptimized: 770942

View File

@ -49,9 +49,9 @@ contract test {
} }
// ---- // ----
// constructor() // constructor()
// gas irOptimized: 634316 // gas irOptimized: 630860
// gas legacy: 1065857 // gas legacy: 1061957
// gas legacyOptimized: 725423 // gas legacyOptimized: 718937
// toSlice(string): 0x20, 11, "hello world" -> 11, 0xa0 // toSlice(string): 0x20, 11, "hello world" -> 11, 0xa0
// gas irOptimized: 22660 // gas irOptimized: 22660
// gas legacy: 23190 // gas legacy: 23190
@ -69,6 +69,6 @@ contract test {
// gas legacy: 31621 // gas legacy: 31621
// gas legacyOptimized: 27914 // gas legacyOptimized: 27914
// benchmark(string,bytes32): 0x40, 0x0842021, 8, "solidity" -> 0x2020 // benchmark(string,bytes32): 0x40, 0x0842021, 8, "solidity" -> 0x2020
// gas irOptimized: 1981677 // gas irOptimized: 1980957
// gas legacy: 4235651 // gas legacy: 4233999
// gas legacyOptimized: 2319622 // gas legacyOptimized: 2318684

View File

@ -22,6 +22,6 @@ contract Test {
// ---- // ----
// library: Lib // library: Lib
// f() -> 4, 0x11 // f() -> 4, 0x11
// gas irOptimized: 112064 // gas irOptimized: 111560
// gas legacy: 135413 // gas legacy: 132935
// gas legacyOptimized: 119325 // gas legacyOptimized: 118023

View File

@ -49,13 +49,13 @@ contract C {
} }
// ---- // ----
// test_f() -> true // test_f() -> true
// gas irOptimized: 122393 // gas irOptimized: 122078
// gas legacy: 126030 // gas legacy: 125322
// gas legacyOptimized: 123120 // gas legacyOptimized: 122709
// test_g() -> true // test_g() -> true
// gas irOptimized: 106740 // gas irOptimized: 106215
// gas legacy: 112300 // gas legacy: 111120
// gas legacyOptimized: 107649 // gas legacyOptimized: 106964
// addresses(uint256): 0 -> 0x18 // addresses(uint256): 0 -> 0x18
// addresses(uint256): 1 -> 0x19 // addresses(uint256): 1 -> 0x19
// addresses(uint256): 3 -> 0x1b // addresses(uint256): 3 -> 0x1b