mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not replace zeros by return variable.
This commit is contained in:
parent
cd13fcd758
commit
00fb2d390b
@ -29,6 +29,7 @@
|
||||
#include <libyul/Exceptions.h>
|
||||
#include <libyul/AST.h>
|
||||
#include <libyul/Dialect.h>
|
||||
#include <libyul/Utilities.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace solidity;
|
||||
@ -52,6 +53,16 @@ CommonSubexpressionEliminator::CommonSubexpressionEliminator(
|
||||
{
|
||||
}
|
||||
|
||||
void CommonSubexpressionEliminator::operator()(FunctionDefinition& _fun)
|
||||
{
|
||||
ScopedSaveAndRestore returnVariables(m_returnVariables, {});
|
||||
|
||||
for (auto const& v: _fun.returnVariables)
|
||||
m_returnVariables.insert(v.name);
|
||||
|
||||
DataFlowAnalyzer::operator()(_fun);
|
||||
}
|
||||
|
||||
void CommonSubexpressionEliminator::visit(Expression& _e)
|
||||
{
|
||||
bool descend = true;
|
||||
@ -82,10 +93,9 @@ void CommonSubexpressionEliminator::visit(Expression& _e)
|
||||
if (descend)
|
||||
DataFlowAnalyzer::visit(_e);
|
||||
|
||||
if (holds_alternative<Identifier>(_e))
|
||||
if (Identifier const* identifier = get_if<Identifier>(&_e))
|
||||
{
|
||||
Identifier& identifier = std::get<Identifier>(_e);
|
||||
YulString name = identifier.name;
|
||||
YulString name = identifier->name;
|
||||
if (m_value.count(name))
|
||||
{
|
||||
assertThrow(m_value.at(name).value, OptimizerException, "");
|
||||
@ -100,6 +110,14 @@ void CommonSubexpressionEliminator::visit(Expression& _e)
|
||||
for (auto const& [variable, value]: m_value)
|
||||
{
|
||||
assertThrow(value.value, OptimizerException, "");
|
||||
// Prevent using the default value of return variables
|
||||
// instead of literal zeros.
|
||||
if (
|
||||
m_returnVariables.count(variable) &&
|
||||
holds_alternative<Literal>(*value.value) &&
|
||||
valueOfLiteral(get<Literal>(*value.value)) == 0
|
||||
)
|
||||
continue;
|
||||
if (SyntacticallyEqual{}(_e, *value.value) && inScope(variable))
|
||||
{
|
||||
_e = Identifier{locationOf(_e), variable};
|
||||
|
@ -25,6 +25,8 @@
|
||||
#include <libyul/optimiser/DataFlowAnalyzer.h>
|
||||
#include <libyul/optimiser/OptimiserStep.h>
|
||||
|
||||
#include <stack>
|
||||
|
||||
namespace solidity::yul
|
||||
{
|
||||
|
||||
@ -43,6 +45,9 @@ public:
|
||||
static constexpr char const* name{"CommonSubexpressionEliminator"};
|
||||
static void run(OptimiserStepContext&, Block& _ast);
|
||||
|
||||
using DataFlowAnalyzer::operator();
|
||||
void operator()(FunctionDefinition&) override;
|
||||
|
||||
private:
|
||||
CommonSubexpressionEliminator(
|
||||
Dialect const& _dialect,
|
||||
@ -52,6 +57,9 @@ private:
|
||||
protected:
|
||||
using ASTModifier::visit;
|
||||
void visit(Expression& _e) override;
|
||||
|
||||
private:
|
||||
std::set<YulString> m_returnVariables;
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -66,4 +66,4 @@ contract C {
|
||||
// test_uint256() ->
|
||||
// gas irOptimized: 704259
|
||||
// gas legacy: 634592
|
||||
// gas legacyOptimized: 499373
|
||||
// gas legacyOptimized: 499337
|
||||
|
@ -67,4 +67,4 @@ contract C {
|
||||
// test_uint256() ->
|
||||
// gas irOptimized: 704259
|
||||
// gas legacy: 634592
|
||||
// gas legacyOptimized: 499373
|
||||
// gas legacyOptimized: 499337
|
||||
|
@ -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: 227067
|
||||
// gas irOptimized: 227075
|
||||
// gas legacy: 144300
|
||||
// gas legacyOptimized: 124189
|
||||
// gas legacyOptimized: 124188
|
||||
|
@ -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: 172480
|
||||
// gas irOptimized: 172488
|
||||
// gas legacy: 175929
|
||||
// gas legacyOptimized: 172504
|
||||
// i(uint256[2][2]): 123, 124, 223, 224 -> 32, 128, 123, 124, 223, 224
|
||||
// gas irOptimized: 107421
|
||||
// gas irOptimized: 107381
|
||||
// gas legacy: 109868
|
||||
// gas legacyOptimized: 107388
|
||||
|
@ -11,6 +11,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(bytes): 0x20, 0x80, 0x21, 0x40, 0x7, "abcdefg" -> 0x21, 0x40, 0x7, "abcdefg"
|
||||
// gas irOptimized: 130131
|
||||
// gas irOptimized: 130136
|
||||
// gas legacy: 131690
|
||||
// gas legacyOptimized: 130577
|
||||
// gas legacyOptimized: 130582
|
||||
|
@ -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: 199727
|
||||
// gas irOptimized: 199732
|
||||
// gas legacy: 278685
|
||||
// gas legacyOptimized: 273594
|
||||
// data(uint256,uint256): 0x02, 0x02 -> 0x09
|
||||
|
@ -47,7 +47,7 @@ contract c {
|
||||
// gas legacyOptimized: 109706
|
||||
// storage: nonempty
|
||||
// test_long() -> 67
|
||||
// gas irOptimized: 134398
|
||||
// gas irOptimized: 134403
|
||||
// gas legacy: 213590
|
||||
// gas legacyOptimized: 211044
|
||||
// storage: nonempty
|
||||
|
@ -19,6 +19,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0
|
||||
// gas irOptimized: 310460
|
||||
// gas irOptimized: 310785
|
||||
// gas legacy: 483915
|
||||
// gas legacyOptimized: 478672
|
||||
|
@ -42,7 +42,7 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0
|
||||
// gas irOptimized: 107698
|
||||
// gas irOptimized: 107703
|
||||
// gas legacy: 107306
|
||||
// gas legacyOptimized: 105861
|
||||
// g() -> 0
|
||||
|
@ -37,7 +37,7 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x02000202
|
||||
// gas irOptimized: 2477765
|
||||
// gas irOptimized: 2471556
|
||||
// gas legacy: 2288641
|
||||
// gas legacyOptimized: 2258654
|
||||
// storage: empty
|
||||
|
@ -15,6 +15,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test(uint256[2][]): 32, 3, 7, 8, 9, 10, 11, 12 -> 10
|
||||
// gas irOptimized: 610552
|
||||
// gas irOptimized: 610560
|
||||
// gas legacy: 604268
|
||||
// gas legacyOptimized: 603688
|
||||
|
@ -23,6 +23,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 3, 4
|
||||
// gas irOptimized: 191170
|
||||
// gas irOptimized: 191158
|
||||
// gas legacy: 208853
|
||||
// gas legacyOptimized: 200341
|
||||
|
@ -20,6 +20,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 5, 4
|
||||
// gas irOptimized: 265174
|
||||
// gas irOptimized: 265126
|
||||
// gas legacy: 264734
|
||||
// gas legacyOptimized: 263160
|
||||
|
@ -18,6 +18,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 8, 0
|
||||
// gas irOptimized: 154793
|
||||
// gas irOptimized: 154656
|
||||
// gas legacy: 153995
|
||||
// gas legacyOptimized: 153403
|
||||
|
@ -17,6 +17,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x20, 2, 0x40, 0xa0, 2, 0, 1, 2, 2, 3
|
||||
// gas irOptimized: 168698
|
||||
// gas irOptimized: 168812
|
||||
// gas legacy: 163978
|
||||
// gas legacyOptimized: 158150
|
||||
// gas legacyOptimized: 158155
|
||||
|
@ -38,10 +38,10 @@ contract c {
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// test1(uint256[][]): 0x20, 2, 0x40, 0x40, 2, 23, 42 -> 2, 65
|
||||
// gas irOptimized: 179276
|
||||
// gas irOptimized: 179354
|
||||
// test2(uint256[][2]): 0x20, 0x40, 0x40, 2, 23, 42 -> 2, 65
|
||||
// gas irOptimized: 154026
|
||||
// gas irOptimized: 154106
|
||||
// test3(uint256[2][]): 0x20, 2, 23, 42, 23, 42 -> 2, 65
|
||||
// gas irOptimized: 132691
|
||||
// gas irOptimized: 132579
|
||||
// test4(uint256[2][2]): 23, 42, 23, 42 -> 65
|
||||
// gas irOptimized: 105429
|
||||
// gas irOptimized: 105395
|
||||
|
@ -23,4 +23,4 @@ contract C {
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f((uint256[])[]): 0x20, 3, 0x60, 0x60, 0x60, 0x20, 3, 1, 2, 3 -> 3, 1
|
||||
// gas irOptimized: 353946
|
||||
// gas irOptimized: 353951
|
||||
|
@ -15,6 +15,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1, 2, 3
|
||||
// gas irOptimized: 133483
|
||||
// gas irOptimized: 133471
|
||||
// gas legacy: 134419
|
||||
// gas legacyOptimized: 125440
|
||||
|
@ -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: 120939
|
||||
// gas irOptimized: 120898
|
||||
// gas legacy: 125815
|
||||
// gas legacyOptimized: 123614
|
||||
// data(uint256): 7 -> 8
|
||||
|
@ -7,11 +7,11 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// set(uint256): 1, 2 -> true
|
||||
// gas irOptimized: 103240
|
||||
// gas irOptimized: 103242
|
||||
// gas legacy: 103491
|
||||
// gas legacyOptimized: 103136
|
||||
// set(uint256): 2, 2, 3, 4, 5 -> true
|
||||
// gas irOptimized: 163927
|
||||
// gas irOptimized: 163929
|
||||
// gas legacy: 164121
|
||||
// gas legacyOptimized: 163766
|
||||
// storage: nonempty
|
||||
|
@ -11,6 +11,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256[]): 0x20, 0x03, 0x1, 0x2, 0x3 -> 0x1
|
||||
// gas irOptimized: 105249
|
||||
// gas irOptimized: 105262
|
||||
// gas legacy: 105365
|
||||
// gas legacyOptimized: 105147
|
||||
|
@ -18,6 +18,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 7
|
||||
// gas irOptimized: 134153
|
||||
// gas irOptimized: 134158
|
||||
// gas legacy: 211296
|
||||
// gas legacyOptimized: 211087
|
||||
|
@ -19,6 +19,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1, 2, 3, 4, 5, 6, 7
|
||||
// gas irOptimized: 212626
|
||||
// gas irOptimized: 212646
|
||||
// gas legacy: 223725
|
||||
// gas legacyOptimized: 222886
|
||||
|
@ -13,6 +13,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 0x20, 0x02, 0x40, 0x80, 3, 0x6162630000000000000000000000000000000000000000000000000000000000, 0x99, 44048183304486788312148433451363384677562265908331949128489393215789685032262, 32241931068525137014058842823026578386641954854143559838526554899205067598957, 49951309422467613961193228765530489307475214998374779756599339590522149884499, 0x54555658595a6162636465666768696a6b6c6d6e6f707172737475767778797a, 0x4142434445464748494a4b4c4d4e4f5051525354555658595a00000000000000
|
||||
// gas irOptimized: 198384
|
||||
// gas irOptimized: 198396
|
||||
// gas legacy: 199159
|
||||
// gas legacyOptimized: 198132
|
||||
// gas legacyOptimized: 198137
|
||||
|
@ -20,6 +20,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 1, 2, 3, 4, 5, 6, 7
|
||||
// gas irOptimized: 212626
|
||||
// gas irOptimized: 212646
|
||||
// gas legacy: 223730
|
||||
// gas legacyOptimized: 222891
|
||||
|
@ -26,6 +26,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 11, 0x0c, 1, 0x15, 22, 4
|
||||
// gas irOptimized: 289307
|
||||
// gas irOptimized: 289252
|
||||
// gas legacy: 296916
|
||||
// gas legacyOptimized: 283163
|
||||
|
@ -18,6 +18,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test1() -> true
|
||||
// gas irOptimized: 531720
|
||||
// gas irOptimized: 532255
|
||||
// gas legacy: 613377
|
||||
// gas legacyOptimized: 606411
|
||||
|
@ -44,7 +44,7 @@ contract c {
|
||||
// ----
|
||||
// getLengths() -> 0, 0
|
||||
// setLengths(uint256,uint256): 48, 49 ->
|
||||
// gas irOptimized: 276212
|
||||
// gas irOptimized: 275838
|
||||
// gas legacy: 308271
|
||||
// gas legacyOptimized: 300117
|
||||
// getLengths() -> 48, 49
|
||||
|
@ -18,7 +18,7 @@ contract c {
|
||||
// ----
|
||||
// storage: empty
|
||||
// fill() -> 8
|
||||
// gas irOptimized: 170087
|
||||
// gas irOptimized: 170102
|
||||
// gas legacy: 165456
|
||||
// gas legacyOptimized: 164387
|
||||
// storage: nonempty
|
||||
|
@ -21,6 +21,6 @@ contract B {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 2, 3, 4, 5, 6, 1000, 1001, 1002, 1003, 1004
|
||||
// gas irOptimized: 135461
|
||||
// gas irOptimized: 135871
|
||||
// gas legacy: 264410
|
||||
// gas legacyOptimized: 134899
|
||||
// gas legacyOptimized: 135699
|
||||
|
@ -45,6 +45,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 5, 6, 7
|
||||
// gas irOptimized: 345131
|
||||
// gas irOptimized: 345542
|
||||
// gas legacy: 500424
|
||||
// gas legacyOptimized: 307813
|
||||
// gas legacyOptimized: 309013
|
||||
|
@ -25,7 +25,7 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 1, 2, 3
|
||||
// gas irOptimized: 2462085
|
||||
// gas irOptimized: 2461941
|
||||
// gas legacy: 2416722
|
||||
// gas legacyOptimized: 2405396
|
||||
// storage: empty
|
||||
|
@ -20,7 +20,7 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 38, 28, 18
|
||||
// gas irOptimized: 531723
|
||||
// gas irOptimized: 532515
|
||||
// gas legacy: 454080
|
||||
// gas legacyOptimized: 443170
|
||||
// storage: empty
|
||||
|
@ -12,6 +12,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x20, 29, 0x0303030303030303030303030303030303030303030303030303030303000000
|
||||
// gas irOptimized: 162649
|
||||
// gas irOptimized: 162592
|
||||
// gas legacy: 245809
|
||||
// gas legacyOptimized: 242636
|
||||
|
@ -12,6 +12,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0x20, 33, 0x303030303030303030303030303030303030303030303030303030303030303, 0x0300000000000000000000000000000000000000000000000000000000000000
|
||||
// gas irOptimized: 160043
|
||||
// gas irOptimized: 159929
|
||||
// gas legacy: 243287
|
||||
// gas legacyOptimized: 240361
|
||||
|
@ -18,6 +18,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 5, 4, 3, 3
|
||||
// gas irOptimized: 110985
|
||||
// gas irOptimized: 110915
|
||||
// gas legacy: 111938
|
||||
// gas legacyOptimized: 110528
|
||||
|
@ -14,6 +14,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint120[]): 0x20, 3, 1, 2, 3 -> 1
|
||||
// gas irOptimized: 116343
|
||||
// gas irOptimized: 116340
|
||||
// gas legacy: 116886
|
||||
// gas legacyOptimized: 116699
|
||||
|
@ -22,6 +22,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 2, 3, 4, 5
|
||||
// gas irOptimized: 146473
|
||||
// gas irOptimized: 146470
|
||||
// gas legacy: 190684
|
||||
// gas legacyOptimized: 188256
|
||||
|
@ -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: 148190
|
||||
// gas irOptimized: 148198
|
||||
// gas legacy: 152444
|
||||
// gas legacyOptimized: 146671
|
||||
|
@ -17,6 +17,6 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// test() -> 0
|
||||
// gas irOptimized: 396077
|
||||
// gas irOptimized: 396502
|
||||
// gas legacy: 565428
|
||||
// gas legacyOptimized: 552524
|
||||
|
@ -23,7 +23,7 @@ contract C {
|
||||
// ----
|
||||
// l() -> 0
|
||||
// g(uint256): 70 ->
|
||||
// gas irOptimized: 434229
|
||||
// gas irOptimized: 430584
|
||||
// gas legacy: 419791
|
||||
// gas legacyOptimized: 415408
|
||||
// l() -> 70
|
||||
|
@ -26,6 +26,6 @@ contract Main {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256): 0x34 -> 0x46bddb1178e94d7f2892ff5f366840eb658911794f2c3a44c450aa2c505186c1
|
||||
// gas irOptimized: 115537
|
||||
// gas irOptimized: 115528
|
||||
// gas legacy: 127152
|
||||
// gas legacyOptimized: 113679
|
||||
|
@ -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: 465850
|
||||
// gas irOptimized: 469081
|
||||
// gas legacy: 570900
|
||||
// gas legacyOptimized: 435524
|
||||
// gas legacyOptimized: 436724
|
||||
|
@ -26,6 +26,6 @@ contract Creator {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f(uint256,bytes): 7, 0x40, 78, "abcdefghijklmnopqrstuvwxyzabcdef", "ghijklmnopqrstuvwxyzabcdefghijkl", "mnopqrstuvwxyz" -> 7, "h"
|
||||
// gas irOptimized: 322968
|
||||
// gas irOptimized: 325793
|
||||
// gas legacy: 414850
|
||||
// gas legacyOptimized: 290278
|
||||
// gas legacyOptimized: 292281
|
||||
|
@ -178,33 +178,33 @@ contract DepositContract is IDepositContract, ERC165 {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// constructor()
|
||||
// gas irOptimized: 1814535
|
||||
// gas irOptimized: 1826340
|
||||
// gas legacy: 2558004
|
||||
// gas legacyOptimized: 1797889
|
||||
// gas legacyOptimized: 1798657
|
||||
// supportsInterface(bytes4): 0x0 -> 0
|
||||
// supportsInterface(bytes4): 0xffffffff00000000000000000000000000000000000000000000000000000000 -> false # defined to be false by ERC-165 #
|
||||
// supportsInterface(bytes4): 0x01ffc9a700000000000000000000000000000000000000000000000000000000 -> true # ERC-165 id #
|
||||
// supportsInterface(bytes4): 0x8564090700000000000000000000000000000000000000000000000000000000 -> true # the deposit interface id #
|
||||
// get_deposit_root() -> 0xd70a234731285c6804c2a4f56711ddb8c82c99740f207854891028af34e27e5e
|
||||
// gas irOptimized: 104399
|
||||
// gas irOptimized: 104382
|
||||
// gas legacy: 128065
|
||||
// gas legacyOptimized: 100398
|
||||
// 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: 104399
|
||||
// gas irOptimized: 104382
|
||||
// gas legacy: 128065
|
||||
// gas legacyOptimized: 100398
|
||||
// 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 #
|
||||
// get_deposit_root() -> 0x2089653123d9c721215120b6db6738ba273bbc5228ac093b1f983badcdc8a438
|
||||
// gas irOptimized: 104403
|
||||
// gas irOptimized: 104386
|
||||
// gas legacy: 128075
|
||||
// gas legacyOptimized: 100411
|
||||
// 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 #
|
||||
// get_deposit_root() -> 0x40255975859377d912c53aa853245ebd939bdd2b33a28e084babdcc1ed8238ee
|
||||
// gas irOptimized: 104403
|
||||
// gas irOptimized: 104386
|
||||
// gas legacy: 128075
|
||||
// gas legacyOptimized: 100411
|
||||
// get_deposit_count() -> 0x20, 8, 0x0200000000000000000000000000000000000000000000000000000000000000
|
||||
|
@ -296,6 +296,6 @@ contract Test {
|
||||
// g() -> true
|
||||
// pair() -> true
|
||||
// verifyTx() -> true
|
||||
// gas irOptimized: 127891
|
||||
// gas irOptimized: 127916
|
||||
// gas legacy: 130571
|
||||
// gas legacyOptimized: 100147
|
||||
|
@ -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: 109912
|
||||
// gas irOptimized: 109814
|
||||
// gas legacy: 111406
|
||||
// gas legacyOptimized: 107981
|
||||
// get(uint8): 1 -> 21, 22, 42, 43
|
||||
|
@ -28,6 +28,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// t() -> 9
|
||||
// gas irOptimized: 103930
|
||||
// gas irOptimized: 103946
|
||||
// gas legacy: 161097
|
||||
// gas legacyOptimized: 111516
|
||||
// gas legacyOptimized: 112116
|
||||
|
@ -29,7 +29,7 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// f() -> 3, 7, 5
|
||||
// gas irOptimized: 131345
|
||||
// gas irOptimized: 131350
|
||||
// gas legacy: 153990
|
||||
// gas legacyOptimized: 127822
|
||||
// x() -> 7
|
||||
|
@ -27,4 +27,4 @@ contract B {
|
||||
// g() -> 42
|
||||
// gas irOptimized: 119646
|
||||
// gas legacy: 180597
|
||||
// gas legacyOptimized: 116351
|
||||
// gas legacyOptimized: 117351
|
||||
|
@ -39,8 +39,8 @@ contract C {
|
||||
// convertParent() -> 1
|
||||
// gas irOptimized: 103625
|
||||
// convertSubA() -> 1, 2
|
||||
// gas irOptimized: 105700
|
||||
// gas irOptimized: 105708
|
||||
// gas legacy: 101703
|
||||
// convertSubB() -> 1, 3
|
||||
// gas irOptimized: 105634
|
||||
// gas irOptimized: 105642
|
||||
// gas legacy: 101637
|
||||
|
@ -22,6 +22,6 @@ contract A {
|
||||
// ----
|
||||
// different_salt() -> true
|
||||
// same_salt() -> true
|
||||
// gas irOptimized: 98438966
|
||||
// gas irOptimized: 98438968
|
||||
// gas legacy: 98439116
|
||||
// gas legacyOptimized: 98438970
|
||||
|
@ -38,12 +38,12 @@ contract c {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// set(uint256): 7 -> true
|
||||
// gas irOptimized: 101844
|
||||
// gas irOptimized: 101849
|
||||
// gas legacy: 102216
|
||||
// gas legacyOptimized: 101606
|
||||
// retrieve(uint256): 7 -> 1, 3, 4, 2
|
||||
// copy(uint256,uint256): 7, 8 -> true
|
||||
// gas irOptimized: 105161
|
||||
// gas irOptimized: 105169
|
||||
// gas legacy: 105566
|
||||
// gas legacyOptimized: 105022
|
||||
// retrieve(uint256): 7 -> 1, 3, 4, 2
|
||||
|
@ -33,4 +33,4 @@ contract C {
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f() -> 0, 0, 0
|
||||
// gas irOptimized: 124955
|
||||
// gas irOptimized: 124110
|
||||
|
@ -27,4 +27,4 @@ contract C {
|
||||
// compileViaYul: true
|
||||
// ----
|
||||
// f() -> 0
|
||||
// gas irOptimized: 118047
|
||||
// gas irOptimized: 118035
|
||||
|
@ -32,7 +32,7 @@ contract test {
|
||||
// ----
|
||||
// check() -> false
|
||||
// set() ->
|
||||
// gas irOptimized: 128462
|
||||
// gas irOptimized: 128459
|
||||
// gas legacy: 129577
|
||||
// gas legacyOptimized: 126964
|
||||
// check() -> true
|
||||
|
@ -38,4 +38,4 @@ contract C {
|
||||
// f(bytes): 0x20, 0x5, "abcde" -> 0
|
||||
// gas irOptimized: 241858
|
||||
// gas legacy: 239258
|
||||
// gas legacyOptimized: 238577
|
||||
// gas legacyOptimized: 238582
|
||||
|
@ -22,6 +22,6 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// g() -> 2, 6
|
||||
// gas irOptimized: 169843
|
||||
// gas irOptimized: 169848
|
||||
// gas legacy: 172490
|
||||
// gas legacyOptimized: 171209
|
||||
|
@ -18,7 +18,7 @@ contract C {
|
||||
// ----
|
||||
// test_indices(uint256): 1 ->
|
||||
// test_indices(uint256): 129 ->
|
||||
// gas irOptimized: 3456682
|
||||
// gas irOptimized: 3457322
|
||||
// gas legacy: 3340105
|
||||
// gas legacyOptimized: 3280773
|
||||
// test_indices(uint256): 5 ->
|
||||
@ -27,13 +27,13 @@ contract C {
|
||||
// gas legacyOptimized: 455849
|
||||
// test_indices(uint256): 10 ->
|
||||
// test_indices(uint256): 15 ->
|
||||
// gas irOptimized: 110410
|
||||
// gas irOptimized: 110435
|
||||
// test_indices(uint256): 0xFF ->
|
||||
// gas irOptimized: 4336990
|
||||
// gas irOptimized: 4338190
|
||||
// gas legacy: 4107867
|
||||
// gas legacyOptimized: 3991807
|
||||
// test_indices(uint256): 1000 ->
|
||||
// gas irOptimized: 21236892
|
||||
// gas irOptimized: 21240617
|
||||
// gas legacy: 20360399
|
||||
// gas legacyOptimized: 19921344
|
||||
// test_indices(uint256): 129 ->
|
||||
|
@ -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: 676497
|
||||
// gas irOptimized: 677730
|
||||
// gas legacy: 648515
|
||||
// gas legacyOptimized: 628739
|
||||
// test_boundary_check(uint256,uint256): 256, 255 -> 0
|
||||
// gas irOptimized: 677515
|
||||
// gas irOptimized: 678750
|
||||
// gas legacy: 649549
|
||||
// gas legacyOptimized: 629633
|
||||
// test_boundary_check(uint256,uint256): 256, 0xFFFF -> FAILURE, hex"4e487b71", 0x32
|
||||
|
@ -54,18 +54,18 @@ contract C {
|
||||
// ----
|
||||
// test_zeroed_indicies(uint256): 1 ->
|
||||
// test_zeroed_indicies(uint256): 5 ->
|
||||
// gas irOptimized: 208617
|
||||
// gas irOptimized: 198357
|
||||
// gas legacy: 191267
|
||||
// gas legacyOptimized: 188486
|
||||
// test_zeroed_indicies(uint256): 10 ->
|
||||
// gas irOptimized: 304639
|
||||
// gas irOptimized: 289249
|
||||
// gas legacy: 276129
|
||||
// gas legacyOptimized: 271024
|
||||
// test_zeroed_indicies(uint256): 15 ->
|
||||
// gas irOptimized: 377949
|
||||
// gas irOptimized: 358284
|
||||
// gas legacy: 339254
|
||||
// gas legacyOptimized: 331904
|
||||
// test_zeroed_indicies(uint256): 0xFF ->
|
||||
// gas irOptimized: 9234149
|
||||
// gas irOptimized: 8808359
|
||||
// gas legacy: 8477449
|
||||
// gas legacyOptimized: 8343774
|
||||
|
@ -13,11 +13,11 @@ contract C {
|
||||
// compileViaYul: also
|
||||
// ----
|
||||
// pushEmpty(uint256): 128
|
||||
// gas irOptimized: 629616
|
||||
// gas irOptimized: 630896
|
||||
// gas legacy: 607287
|
||||
// gas legacyOptimized: 589048
|
||||
// pushEmpty(uint256): 256
|
||||
// gas irOptimized: 859120
|
||||
// gas irOptimized: 861040
|
||||
// gas legacy: 828983
|
||||
// gas legacyOptimized: 802808
|
||||
// pushEmpty(uint256): 32768 -> FAILURE # out-of-gas #
|
||||
|
@ -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: 109979
|
||||
// gas irOptimized: 110079
|
||||
// gas legacy: 107830
|
||||
// gas legacyOptimized: 107262
|
||||
// set_get_length(uint256): 0xFF -> 0xFF
|
||||
// gas irOptimized: 700231
|
||||
// gas irOptimized: 701506
|
||||
// gas legacy: 882337
|
||||
// gas legacyOptimized: 650704
|
||||
// set_get_length(uint256): 0xFFF -> 0xFFF
|
||||
// gas irOptimized: 10207663
|
||||
// gas irOptimized: 10226863
|
||||
// gas legacy: 12945874
|
||||
// gas legacyOptimized: 9462646
|
||||
// set_get_length(uint256): 0xFFFF -> FAILURE # Out-of-gas #
|
||||
|
@ -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: 162305
|
||||
// gas irOptimized: 162505
|
||||
// gas legacy: 141922
|
||||
// gas legacyOptimized: 139708
|
||||
// set_get_length(uint256): 0xFF -> 0
|
||||
// gas irOptimized: 1787800
|
||||
// gas irOptimized: 1790350
|
||||
// gas legacy: 1524427
|
||||
// gas legacyOptimized: 1500358
|
||||
// set_get_length(uint256): 0xFFF -> 0
|
||||
// gas irOptimized: 28349092
|
||||
// gas irOptimized: 28390042
|
||||
// gas legacy: 24115159
|
||||
// gas legacyOptimized: 23733970
|
||||
// set_get_length(uint256): 0xFFFF -> FAILURE # Out-of-gas #
|
||||
|
@ -18,7 +18,7 @@
|
||||
// sstore(a, a)
|
||||
// function f() -> x
|
||||
// {
|
||||
// let y := x
|
||||
// mstore(x, 7)
|
||||
// let y := 0
|
||||
// mstore(y, 7)
|
||||
// }
|
||||
// }
|
||||
|
@ -10,5 +10,5 @@
|
||||
// {
|
||||
// sstore(sub(f(), f()), 8)
|
||||
// function f() -> a
|
||||
// { mstore(a, 1) }
|
||||
// { mstore(0, 1) }
|
||||
// }
|
||||
|
@ -11,5 +11,5 @@
|
||||
// pop(f())
|
||||
// mstore(0, 0)
|
||||
// function f() -> x
|
||||
// { mstore(x, 1337) }
|
||||
// { mstore(0, 1337) }
|
||||
// }
|
||||
|
@ -12,5 +12,5 @@
|
||||
// {
|
||||
// let t, v := f()
|
||||
// function f() -> c, d
|
||||
// { sstore(d, 7) }
|
||||
// { sstore(0, 7) }
|
||||
// }
|
||||
|
@ -1089,21 +1089,21 @@
|
||||
// }
|
||||
// function abi_decode_addresst_uint256t_bytes_calldatat_enum_Operation(headStart, dataEnd) -> value0, value1, value2, value3, value4
|
||||
// {
|
||||
// if slt(sub(dataEnd, headStart), 128) { revert(value4, value4) }
|
||||
// if slt(sub(dataEnd, headStart), 128) { revert(0, 0) }
|
||||
// value0 := and(calldataload(headStart), sub(shl(160, 1), 1))
|
||||
// value1 := calldataload(add(headStart, 32))
|
||||
// let offset := calldataload(add(headStart, 64))
|
||||
// let _1 := 0xffffffffffffffff
|
||||
// if gt(offset, _1) { revert(value4, value4) }
|
||||
// if gt(offset, _1) { revert(0, 0) }
|
||||
// let _2 := add(headStart, offset)
|
||||
// if iszero(slt(add(_2, 0x1f), dataEnd)) { revert(value4, value4) }
|
||||
// if iszero(slt(add(_2, 0x1f), dataEnd)) { revert(0, 0) }
|
||||
// let length := calldataload(_2)
|
||||
// if gt(length, _1) { revert(value4, value4) }
|
||||
// if gt(add(add(_2, length), 32), dataEnd) { revert(value4, value4) }
|
||||
// if gt(length, _1) { revert(0, 0) }
|
||||
// if gt(add(add(_2, length), 32), dataEnd) { revert(0, 0) }
|
||||
// value2 := add(_2, 32)
|
||||
// value3 := length
|
||||
// let _3 := calldataload(add(headStart, 96))
|
||||
// if iszero(lt(_3, 3)) { revert(value4, value4) }
|
||||
// if iszero(lt(_3, 3)) { revert(0, 0) }
|
||||
// value4 := _3
|
||||
// }
|
||||
// function abi_encode_bytes32_address_uint256_bytes32_enum_Operation_uint256_uint256_uint256_address_address_uint256(headStart, value10, value9, value8, value7, value6, value5, value4, value3, value2, value1, value0) -> tail
|
||||
|
@ -494,7 +494,7 @@
|
||||
// function abi_decode_array_array_uint256_memory_dyn(offset, end) -> array
|
||||
// {
|
||||
// let _1 := 0x1f
|
||||
// if iszero(slt(add(offset, _1), end)) { revert(array, array) }
|
||||
// if iszero(slt(add(offset, _1), end)) { revert(0, 0) }
|
||||
// let length := calldataload(offset)
|
||||
// array := allocateMemory(array_allocation_size_array_address_dyn_memory(length))
|
||||
// let dst := array
|
||||
@ -526,23 +526,23 @@
|
||||
// }
|
||||
// function abi_decode_uint256t_uint256t_array_uint256_dynt_array_array_uint256_memory_dyn(headStart, dataEnd) -> value0, value1, value2, value3
|
||||
// {
|
||||
// if slt(sub(dataEnd, headStart), 128) { revert(value2, value2) }
|
||||
// if slt(sub(dataEnd, headStart), 128) { revert(0, 0) }
|
||||
// value0 := calldataload(headStart)
|
||||
// let _1 := 32
|
||||
// value1 := calldataload(add(headStart, _1))
|
||||
// let offset := calldataload(add(headStart, 64))
|
||||
// let _2 := 0xffffffffffffffff
|
||||
// if gt(offset, _2) { revert(value2, value2) }
|
||||
// if gt(offset, _2) { revert(0, 0) }
|
||||
// let _3 := add(headStart, offset)
|
||||
// if iszero(slt(add(_3, 0x1f), dataEnd)) { revert(value2, value2) }
|
||||
// if iszero(slt(add(_3, 0x1f), dataEnd)) { revert(0, 0) }
|
||||
// let length := calldataload(_3)
|
||||
// let dst := allocateMemory(array_allocation_size_array_address_dyn_memory(length))
|
||||
// let dst_1 := dst
|
||||
// mstore(dst, length)
|
||||
// dst := add(dst, _1)
|
||||
// let src := add(_3, _1)
|
||||
// if gt(add(add(_3, shl(5, length)), _1), dataEnd) { revert(value2, value2) }
|
||||
// let i := value2
|
||||
// if gt(add(add(_3, shl(5, length)), _1), dataEnd) { revert(0, 0) }
|
||||
// let i := 0
|
||||
// for { } lt(i, length) { i := add(i, 1) }
|
||||
// {
|
||||
// mstore(dst, calldataload(src))
|
||||
@ -551,7 +551,7 @@
|
||||
// }
|
||||
// value2 := dst_1
|
||||
// let offset_1 := calldataload(add(headStart, 96))
|
||||
// if gt(offset_1, _2) { revert(value3, value3) }
|
||||
// if gt(offset_1, _2) { revert(0, 0) }
|
||||
// value3 := abi_decode_array_array_uint256_memory_dyn(add(headStart, offset_1), dataEnd)
|
||||
// }
|
||||
// function allocateMemory_967() -> memPtr
|
||||
@ -570,7 +570,7 @@
|
||||
// }
|
||||
// function array_allocation_size_array_address_dyn_memory(length) -> size
|
||||
// {
|
||||
// if gt(length, 0xffffffffffffffff) { revert(size, size) }
|
||||
// if gt(length, 0xffffffffffffffff) { revert(0, 0) }
|
||||
// size := add(shl(5, length), 0x20)
|
||||
// }
|
||||
// }
|
||||
|
@ -26,7 +26,7 @@
|
||||
// }
|
||||
// function datasize_(x) -> linkersymbol_
|
||||
// {
|
||||
// if calldataload(linkersymbol_) { linkersymbol_ := datasize_(x) }
|
||||
// if calldataload(0) { linkersymbol_ := datasize_(x) }
|
||||
// sstore(linkersymbol_, calldataload(linkersymbol_))
|
||||
// }
|
||||
// }
|
||||
|
@ -47,9 +47,9 @@
|
||||
// }
|
||||
// function abi_decode_bytes_calldata(offset, end) -> arrayPos, length
|
||||
// {
|
||||
// if iszero(slt(add(offset, 0x1f), end)) { revert(arrayPos, arrayPos) }
|
||||
// if iszero(slt(add(offset, 0x1f), end)) { revert(0, 0) }
|
||||
// length := calldataload(offset)
|
||||
// if gt(length, 0xffffffffffffffff) { revert(arrayPos, arrayPos) }
|
||||
// if gt(length, 0xffffffffffffffff) { revert(0, 0) }
|
||||
// arrayPos := add(offset, 0x20)
|
||||
// if gt(add(add(offset, length), 0x20), end) { revert(0, 0) }
|
||||
// }
|
||||
|
@ -28,15 +28,9 @@
|
||||
// mstore(a, b)
|
||||
// function abi_decode_t_bytes_calldata_ptr(offset_12, end_13) -> arrayPos_14, length_15
|
||||
// {
|
||||
// if iszero(slt(add(offset_12, 0x1f), end_13))
|
||||
// {
|
||||
// revert(arrayPos_14, arrayPos_14)
|
||||
// }
|
||||
// if iszero(slt(add(offset_12, 0x1f), end_13)) { revert(0, 0) }
|
||||
// length_15 := calldataload(offset_12)
|
||||
// if gt(length_15, 0xffffffffffffffff)
|
||||
// {
|
||||
// revert(arrayPos_14, arrayPos_14)
|
||||
// }
|
||||
// if gt(length_15, 0xffffffffffffffff) { revert(0, 0) }
|
||||
// arrayPos_14 := add(offset_12, 0x20)
|
||||
// if gt(add(add(offset_12, length_15), 0x20), end_13) { revert(0, 0) }
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user