Inline tiny functions first.

This commit is contained in:
chriseth 2020-09-09 15:07:38 +02:00
parent f102feaf09
commit 42c26e0bf5
8 changed files with 182 additions and 315 deletions

View File

@ -42,7 +42,9 @@ using namespace solidity::yul;
void FullInliner::run(OptimiserStepContext& _context, Block& _ast)
{
FullInliner{_ast, _context.dispenser, _context.dialect}.run();
FullInliner inliner{_ast, _context.dispenser, _context.dialect};
inliner.run(Pass::InlineTiny);
inliner.run(Pass::InlineRest);
}
FullInliner::FullInliner(Block& _ast, NameDispenser& _dispenser, Dialect const& _dialect):
@ -73,8 +75,10 @@ FullInliner::FullInliner(Block& _ast, NameDispenser& _dispenser, Dialect const&
}
}
void FullInliner::run()
void FullInliner::run(Pass _pass)
{
m_pass = _pass;
// Note that the order of inlining can result in very different code.
// Since AST IDs and thus function names depend on whether or not a contract
// is compiled together with other source files, a change in AST IDs
@ -171,6 +175,10 @@ bool FullInliner::shallInline(FunctionCall const& _funCall, YulString _callSite)
if (size <= 1)
return true;
// In the first pass, only inline tiny functions.
if (m_pass == Pass::InlineTiny)
return false;
// Do not inline into already big functions.
if (m_functionSizes.at(_callSite) > 45)
return false;

View File

@ -91,8 +91,10 @@ public:
void tentativelyUpdateCodeSize(YulString _function, YulString _callSite);
private:
enum Pass { InlineTiny, InlineRest };
FullInliner(Block& _ast, NameDispenser& _dispenser, Dialect const& _dialect);
void run();
void run(Pass _pass);
/// @returns a map containing the maximum depths of a call chain starting at each
/// function. For recursive functions, the value is one larger than for all others.
@ -102,6 +104,7 @@ private:
void handleBlock(YulString _currentFunctionName, Block& _block);
bool recursive(FunctionDefinition const& _fun) const;
Pass m_pass;
/// The AST to be modified. The root block itself will not be modified, because
/// we store pointers to functions.
Block& m_ast;

View File

@ -31,9 +31,10 @@ object "object" {
let x_6 := x_2
let x_7 := x_3
let _2 := 1
let _3:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(i64.or(_1, _1), i64.or(_1, _2)))))
let _3 := i64.or(_1, _1)
let _4:i32 := i32.eqz(i32.eqz(i64.eqz(i64.or(_3, i64.or(_1, _2)))))
for { }
i32.eqz(_3)
i32.eqz(_4)
{
let x_8, x_9, x_10, x_11 := add(x_4, x_5, x_6, x_7, _1, _1, _1, _2)
x_4 := x_8
@ -42,13 +43,10 @@ object "object" {
x_7 := x_11
}
{
let _4, _5, _6, _7 := lt_172_762(x_4, x_5, x_6, x_7, _1, _1, _1, 10)
let _8, _9, _10, _11 := iszero_170_760(_4, _5, _6, _7)
if i32.eqz(i64.eqz(i64.or(i64.or(_8, _9), i64.or(_10, _11)))) { break }
let _12, _13, _14, _15 := eq_171_761(x_4, x_5, x_6, x_7, _1, _1, _1, 2)
if i32.eqz(i64.eqz(i64.or(i64.or(_12, _13), i64.or(_14, _15)))) { break }
let _16, _17, _18, _19 := eq_171_761(x_4, x_5, x_6, x_7, _1, _1, _1, 4)
if i32.eqz(i64.eqz(i64.or(i64.or(_16, _17), i64.or(_18, _19)))) { continue }
let _5, _6, _7, _8 := iszero_170_789(_1, _1, _1, lt_172(x_4, x_5, x_6, x_7, _1, _1, _1, 10))
if i32.eqz(i64.eqz(i64.or(i64.or(_5, _6), i64.or(_7, _8)))) { break }
if i32.eqz(i64.eqz(i64.or(_3, i64.or(_1, eq(x_4, x_5, x_6, x_7, _1, _1, _1, 2))))) { break }
if i32.eqz(i64.eqz(i64.or(_3, i64.or(_1, eq(x_4, x_5, x_6, x_7, _1, _1, _1, 4))))) { continue }
}
sstore(_1, _1, _1, _1, x_4, x_5, x_6, x_7)
}
@ -69,24 +67,19 @@ object "object" {
let r1_1, carry_2 := add_carry(x1, y1, carry_1)
r1 := r1_1
}
function iszero_170_760(x1, x2, x3, x4) -> r1, r2, r3, r4
function iszero_170_789(x1, x2, x3, x4) -> r1, r2, r3, r4
{
r4 := i64.extend_i32_u(i64.eqz(i64.or(i64.or(x1, x2), i64.or(x3, x4))))
}
function eq_171_761(x1, x2, x3, x4, y1, y2, y3, y4) -> r1, r2, r3, r4
function eq(x1, x2, x3, x4, y1, y2, y3, y4) -> r4
{
let r4_1 := 0
if i64.eq(x1, y1)
{
if i64.eq(x2, y2)
{
if i64.eq(x3, y3)
{
if i64.eq(x4, y4) { r4_1 := 1 }
}
if i64.eq(x3, y3) { if i64.eq(x4, y4) { r4 := 1 } }
}
}
r4 := r4_1
}
function cmp(a, b) -> r:i32
{
@ -94,7 +87,7 @@ object "object" {
case 1:i32 { r := 0xffffffff:i32 }
default { r := i64.ne(a, b) }
}
function lt_172_762(x1, x2, x3, x4, y1, y2, y3, y4) -> z1, z2, z3, z4
function lt_172(x1, x2, x3, x4, y1, y2, y3, y4) -> z4
{
let z:i32 := false
switch cmp(x1, y1)
@ -159,7 +152,7 @@ object "object" {
Binary representation:
0061736d0100000001480a60000060017e017e60027e7e017f60037e7e7e017e60047e7e7e7e017e60087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60057f7e7e7e7e0060027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003060406020604010101070505030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020acb080dde02030a7e017f147e02404200210002402000200020002000100921012300210223012103230221040b20012105200221062003210720042108420121092000200084200020098484504545210a02400340200a45450d01024002402005200620072008200020002000420a1008210b2300210c2301210d2302210e0b0240200b200c200d200e1005210f2300211023012111230221120b200f201084201120128484504504400c030b024020052006200720082000200020004202100621132300211423012115230221160b2013201484201520168484504504400c030b0240200520062007200820002000200042041006211723002118230121192302211a0b20172018842019201a8484504504400c010b0b0240200520062007200820002000200020091004211b2300211c2301211d2302211e0b201b2105201c2106201d2107201e21080c000b0b20002000200020002005200620072008100e0b0b2901037e0240200020017c2105200520027c21032005200054200320055472ad21040b2004240020030b6c010b7e0240200320077c210c200c42007c210b024020022006200c200354200b200c5472ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2401047e0240200020018420022003848450ad21070b20052400200624012007240220040b4101057e02404200210c200020045104402001200551044020022006510440200320075104404201210c0b0b0b0b200c210b0b20092400200a2401200b240220080b2701027f024002402000200154210320034101460440417f210205200020015221020b0b0b20020b960102047e047f02404100210c0240200020041007210d200d41004604400240200120051007210e200e41004604400240200220061007210f200f41004604402003200754210c05200f41014604404100210c054101210c0b0b0b05200e41014604404100210c054101210c0b0b0b05200d41014604404100210c054101210c0b0b0b200cad210b0b20092400200a2401200b240220080b7601087e024042002000200184200284520440000b42002003422088520440000b41002003a7412010014100290000100c2108410041086a290000100c2109410041106a290000100c210a410041186a290000100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b3200024020002001100c370000200041086a2002100c370000200041106a2003100c370000200041186a2004100c3700000b0b2300024041002000200120022003100d41202004200520062007100d4100412010000b0b
0061736d0100000001480a60000060017e017e60027e7e017f60037e7e7e017e60047e7e7e7e017e60087e7e7e7e7e7e7e7e0060087e7e7e7e7e7e7e7e017e60057f7e7e7e7e0060027f7f0060037f7f7f0002310208657468657265756d0c73746f7261676553746f7265000808657468657265756d0c63616c6c44617461436f70790009030e0d0003060406020604010101070505030100010610037e0142000b7e0142000b7e0142000b071102066d656d6f72790200046d61696e00020af0070da302030b7e017f087e02404200210002402000200020002000100921012300210223012103230221040b20012105200221062003210720042108420121092000200084210a200a200020098484504545210b02400340200b45450d01024002402000200020002005200620072008200020002000420a10081005210c2300210d2301210e2302210f0b200c200d84200e200f8484504504400c030b200a20002005200620072008200020002000420210068484504504400c030b200a20002005200620072008200020002000420410068484504504400c010b0b024020052006200720082000200020002009100421102300211123012112230221130b201021052011210620122107201321080c000b0b20002000200020002005200620072008100e0b0b2901037e0240200020017c2105200520027c21032005200054200320055472ad21040b2004240020030b6c010b7e0240200320077c210c200c42007c210b024020022006200c200354200b200c5472ad1003210d2300210e0b200d210a024020012005200e1003210f230021100b200f2109024020002004201010032111230021120b201121080b20092400200a2401200b240220080b2401047e0240200020018420022003848450ad21070b20052400200624012007240220040b2d01017e024020002004510440200120055104402002200651044020032007510440420121080b0b0b0b0b20080b2701027f024002402000200154210320034101460440417f210205200020015221020b0b0b20020b8a0102017e047f0240410021090240200020041007210a200a41004604400240200120051007210b200b41004604400240200220061007210c200c41004604402003200754210905200c41014604404100210905410121090b0b0b05200b41014604404100210905410121090b0b0b05200a41014604404100210905410121090b0b0b2009ad21080b20080b7601087e024042002000200184200284520440000b42002003422088520440000b41002003a7412010014100290000100c2108410041086a290000100c2109410041106a290000100c210a410041186a290000100c210b2008210420092105200a2106200b21070b20052400200624012007240220040b1f01017e024020004208864280fe0383200042088842ff01838421010b20010b1e01027e02402000100a421086210220022000421088100a8421010b20010b1e01027e02402000100b422086210220022000422088100b8421010b20010b3200024020002001100c370000200041086a2002100c370000200041106a2003100c370000200041186a2004100c3700000b0b2300024041002000200120022003100d41202004200520062007100d4100412010000b0b
Text representation:
(module
@ -182,23 +175,12 @@ Text representation:
(local $x_6 i64)
(local $x_7 i64)
(local $_2 i64)
(local $_3 i32)
(local $_4 i64)
(local $_3 i64)
(local $_4 i32)
(local $_5 i64)
(local $_6 i64)
(local $_7 i64)
(local $_8 i64)
(local $_9 i64)
(local $_10 i64)
(local $_11 i64)
(local $_12 i64)
(local $_13 i64)
(local $_14 i64)
(local $_15 i64)
(local $_16 i64)
(local $_17 i64)
(local $_18 i64)
(local $_19 i64)
(local $x_8 i64)
(local $x_9 i64)
(local $x_10 i64)
@ -217,46 +199,26 @@ Text representation:
(local.set $x_6 (local.get $x_2))
(local.set $x_7 (local.get $x_3))
(local.set $_2 (i64.const 1))
(local.set $_3 (i32.eqz (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_1) (local.get $_1)) (i64.or (local.get $_1) (local.get $_2)))))))
(local.set $_3 (i64.or (local.get $_1) (local.get $_1)))
(local.set $_4 (i32.eqz (i32.eqz (i64.eqz (i64.or (local.get $_3) (i64.or (local.get $_1) (local.get $_2)))))))
(block $label__3
(loop $label__5
(br_if $label__3 (i32.eqz (i32.eqz (local.get $_3))))
(br_if $label__3 (i32.eqz (i32.eqz (local.get $_4))))
(block $label__4
(block
(local.set $_4 (call $lt_172_762 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10)))
(local.set $_5 (global.get $global_))
(local.set $_6 (global.get $global__1))
(local.set $_7 (global.get $global__2))
(local.set $_5 (call $iszero_170_789 (local.get $_1) (local.get $_1) (local.get $_1) (call $lt_172 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 10))))
(local.set $_6 (global.get $global_))
(local.set $_7 (global.get $global__1))
(local.set $_8 (global.get $global__2))
)
(block
(local.set $_8 (call $iszero_170_760 (local.get $_4) (local.get $_5) (local.get $_6) (local.get $_7)))
(local.set $_9 (global.get $global_))
(local.set $_10 (global.get $global__1))
(local.set $_11 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_8) (local.get $_9)) (i64.or (local.get $_10) (local.get $_11))))) (then
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_5) (local.get $_6)) (i64.or (local.get $_7) (local.get $_8))))) (then
(br $label__3)
))
(block
(local.set $_12 (call $eq_171_761 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2)))
(local.set $_13 (global.get $global_))
(local.set $_14 (global.get $global__1))
(local.set $_15 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_12) (local.get $_13)) (i64.or (local.get $_14) (local.get $_15))))) (then
(if (i32.eqz (i64.eqz (i64.or (local.get $_3) (i64.or (local.get $_1) (call $eq (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 2)))))) (then
(br $label__3)
))
(block
(local.set $_16 (call $eq_171_761 (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4)))
(local.set $_17 (global.get $global_))
(local.set $_18 (global.get $global__1))
(local.set $_19 (global.get $global__2))
)
(if (i32.eqz (i64.eqz (i64.or (i64.or (local.get $_16) (local.get $_17)) (i64.or (local.get $_18) (local.get $_19))))) (then
(if (i32.eqz (i64.eqz (i64.or (local.get $_3) (i64.or (local.get $_1) (call $eq (local.get $x_4) (local.get $x_5) (local.get $x_6) (local.get $x_7) (local.get $_1) (local.get $_1) (local.get $_1) (i64.const 4)))))) (then
(br $label__4)
))
@ -348,7 +310,7 @@ Text representation:
(local.get $r1)
)
(func $iszero_170_760
(func $iszero_170_789
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
@ -368,7 +330,7 @@ Text representation:
(local.get $r1)
)
(func $eq_171_761
(func $eq
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
@ -378,29 +340,20 @@ Text representation:
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $r1 i64)
(local $r2 i64)
(local $r3 i64)
(local $r4 i64)
(local $r4_1 i64)
(block $label__9
(local.set $r4_1 (i64.const 0))
(if (i64.eq (local.get $x1) (local.get $y1)) (then
(if (i64.eq (local.get $x2) (local.get $y2)) (then
(if (i64.eq (local.get $x3) (local.get $y3)) (then
(if (i64.eq (local.get $x4) (local.get $y4)) (then
(local.set $r4_1 (i64.const 1))
(local.set $r4 (i64.const 1))
))
))
))
))
(local.set $r4 (local.get $r4_1))
)
(global.set $global_ (local.get $r2))
(global.set $global__1 (local.get $r3))
(global.set $global__2 (local.get $r4))
(local.get $r1)
(local.get $r4)
)
(func $cmp
@ -424,7 +377,7 @@ Text representation:
(local.get $r)
)
(func $lt_172_762
(func $lt_172
(param $x1 i64)
(param $x2 i64)
(param $x3 i64)
@ -434,9 +387,6 @@ Text representation:
(param $y3 i64)
(param $y4 i64)
(result i64)
(local $z1 i64)
(local $z2 i64)
(local $z3 i64)
(local $z4 i64)
(local $z i32)
(local $condition_12 i32)
@ -484,10 +434,7 @@ Text representation:
(local.set $z4 (i64.extend_i32_u (local.get $z)))
)
(global.set $global_ (local.get $z2))
(global.set $global__1 (local.get $z3))
(global.set $global__2 (local.get $z4))
(local.get $z1)
(local.get $z4)
)
(func $calldataload

View File

@ -5,286 +5,201 @@ Pretty printed source:
object "object" {
code {
{
let a1, b1, c1, d1, e1, f1, g1, h1, i1, j1, k1, l1, m1, n1, o1, p1 := fun_66_345()
let a2, b2, c2, d2, e2, f2, g2, h2, i2, j2, k2, l2, m2, n2, o2, p2 := fun_66_345()
sstore(a1, a2)
}
function fun_66_345() -> a3, b3, c3, d3, e3, f3, g3, h3, i3, j3, k3, l3, m3, n3, o3, p3
{
sstore(1, 1)
sstore(2, 1)
sstore(3, 1)
sstore(4, 1)
sstore(5, 1)
sstore(6, 1)
sstore(7, 1)
sstore(8, 1)
sstore(9, 1)
sstore(10, 1)
sstore(11, 1)
sstore(12, 1)
sstore(13, 1)
a3 := 1
b3 := a3
c3 := a3
d3 := a3
e3 := a3
f3 := a3
g3 := a3
h3 := a3
i3 := a3
j3 := a3
k3 := a3
l3 := a3
m3 := a3
o3 := a3
p3 := a3
let _1 := 1
sstore(_1, _1)
sstore(2, _1)
sstore(3, _1)
sstore(4, _1)
sstore(5, _1)
sstore(6, _1)
sstore(7, _1)
sstore(8, _1)
sstore(9, _1)
sstore(10, _1)
sstore(11, _1)
sstore(12, _1)
sstore(13, _1)
sstore(_1, _1)
sstore(2, _1)
sstore(3, _1)
sstore(4, _1)
sstore(5, _1)
sstore(6, _1)
sstore(7, _1)
sstore(8, _1)
sstore(9, _1)
sstore(10, _1)
sstore(11, _1)
sstore(12, _1)
sstore(13, _1)
sstore(_1, _1)
}
}
}
Binary representation:
60056032565b505050505050505050505050505050601a6032565b505050505050505050505050505050808255505060d4565b60006000600060006000600060006000600060006000600060006000600060006001600155600160025560016003556001600455600160055560016006556001600755600160085560016009556001600a556001600b556001600c556001600d5560019f508f9e508f9d508f9c508f9b508f9a508f99508f98508f97508f96508f95508f94508f93508f91508f90505b909192939495969798999a9b9c9d9e9f565b
6001808155806002558060035580600455806005558060065580600755806008558060095580600a5580600b5580600c5580600d55808155806002558060035580600455806005558060065580600755806008558060095580600a5580600b5580600c5580600d5580815550
Text representation:
/* "yul_stack_opt/input.sol":645:650 */
tag_1
tag_2
jump // in
tag_1:
/* "yul_stack_opt/input.sol":575:650 */
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
/* "yul_stack_opt/input.sol":722:727 */
tag_3
tag_2
jump // in
tag_3:
/* "yul_stack_opt/input.sol":652:727 */
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
pop
/* "yul_stack_opt/input.sol":740:742 */
dup1
/* "yul_stack_opt/input.sol":736:738 */
dup3
/* "yul_stack_opt/input.sol":729:743 */
sstore
pop
pop
/* "yul_stack_opt/input.sol":3:573 */
jump(tag_4)
tag_2:
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
0x00
/* "yul_stack_opt/input.sol":98:99 */
0x01
0x01
dup1
dup2
/* "yul_stack_opt/input.sol":129:141 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":151:160 */
0x02
/* "yul_stack_opt/input.sol":144:164 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":174:183 */
0x03
/* "yul_stack_opt/input.sol":167:187 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":197:206 */
0x04
/* "yul_stack_opt/input.sol":190:210 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":220:229 */
0x05
/* "yul_stack_opt/input.sol":213:233 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":243:252 */
0x06
/* "yul_stack_opt/input.sol":236:256 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":266:275 */
0x07
/* "yul_stack_opt/input.sol":259:279 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":289:298 */
0x08
/* "yul_stack_opt/input.sol":282:302 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":312:321 */
0x09
/* "yul_stack_opt/input.sol":305:325 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":335:344 */
0x0a
/* "yul_stack_opt/input.sol":328:348 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":358:368 */
0x0b
/* "yul_stack_opt/input.sol":351:372 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":382:392 */
0x0c
/* "yul_stack_opt/input.sol":375:396 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
dup1
/* "yul_stack_opt/input.sol":406:416 */
0x0d
/* "yul_stack_opt/input.sol":399:420 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
0x01
/* "yul_stack_opt/input.sol":3:573 */
swap16
pop
dup1
dup2
/* "yul_stack_opt/input.sol":129:141 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap15
pop
dup1
/* "yul_stack_opt/input.sol":151:160 */
0x02
/* "yul_stack_opt/input.sol":144:164 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap14
pop
dup1
/* "yul_stack_opt/input.sol":174:183 */
0x03
/* "yul_stack_opt/input.sol":167:187 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap13
pop
dup1
/* "yul_stack_opt/input.sol":197:206 */
0x04
/* "yul_stack_opt/input.sol":190:210 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap12
pop
dup1
/* "yul_stack_opt/input.sol":220:229 */
0x05
/* "yul_stack_opt/input.sol":213:233 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap11
pop
dup1
/* "yul_stack_opt/input.sol":243:252 */
0x06
/* "yul_stack_opt/input.sol":236:256 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap10
pop
dup1
/* "yul_stack_opt/input.sol":266:275 */
0x07
/* "yul_stack_opt/input.sol":259:279 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap9
pop
dup1
/* "yul_stack_opt/input.sol":289:298 */
0x08
/* "yul_stack_opt/input.sol":282:302 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap8
pop
dup1
/* "yul_stack_opt/input.sol":312:321 */
0x09
/* "yul_stack_opt/input.sol":305:325 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap7
pop
dup1
/* "yul_stack_opt/input.sol":335:344 */
0x0a
/* "yul_stack_opt/input.sol":328:348 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap6
pop
dup1
/* "yul_stack_opt/input.sol":358:368 */
0x0b
/* "yul_stack_opt/input.sol":351:372 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap5
pop
dup1
/* "yul_stack_opt/input.sol":382:392 */
0x0c
/* "yul_stack_opt/input.sol":375:396 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap4
pop
dup1
/* "yul_stack_opt/input.sol":406:416 */
0x0d
/* "yul_stack_opt/input.sol":399:420 */
sstore
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap2
dup1
dup2
/* "yul_stack_opt/input.sol":729:743 */
sstore
pop
/* "yul_stack_opt/input.sol":98:99 */
dup16
/* "yul_stack_opt/input.sol":3:573 */
swap1
pop
tag_5:
swap1
swap2
swap3
swap4
swap5
swap6
swap7
swap8
swap9
swap10
swap11
swap12
swap13
swap14
swap15
swap16
jump // out
tag_4:

View File

@ -49,7 +49,7 @@
// sstore(not(gcd(10, 15)), 1)
// sstore(0, 0)
// sstore(2, 1)
// pop(foo_singlereturn_1_78_308(calldataload(0), calldataload(3)))
// extcodecopy(1, msize(), 1, 1)
// sstore(0, 0)
// sstore(3, 1)
// }
@ -59,6 +59,4 @@
// case 0 { out := _a }
// default { out := gcd(_b, mod(_a, _b)) }
// }
// function foo_singlereturn_1_78_308(in, in_1) -> out
// { extcodecopy(1, msize(), 1, 1) }
// }

View File

@ -18,17 +18,13 @@
// {
// {
// let _1 := sload(32)
// let x, y := foo_21_70(sload(0), _1)
// sstore(0, x)
// sstore(0, y)
// let x_1, y_1 := foo_21_70(_1, sload(8))
// }
// function foo_21_70(a, b) -> out1, out2
// {
// let out1 := sload(mload(32))
// let out2 := add(out1, 1)
// extcodecopy(out1, out2, 1, _1)
// sstore(0, out1)
// sstore(0, out2)
// let _2 := sload(8)
// let out1_1 := sload(mload(32))
// let out2_1 := add(out1_1, 1)
// extcodecopy(out1_1, out2_1, 1, b)
// out1 := out1_1
// out2 := out2_1
// extcodecopy(out1_1, add(out1_1, 1), 1, _2)
// }
// }

View File

@ -15,15 +15,19 @@
//
// {
// {
// sstore(f_23_88(1), 1)
// sstore(f_23_88(2), 1)
// sstore(f_23_88(3), 1)
// }
// function f_23_88(a) -> x
// {
// let b := 10
// let a_1 := calldataload(x)
// let _1 := 0
// let a := calldataload(_1)
// for { } iszero(b) { b := add(b, not(0)) }
// { mstore(a_1, x) }
// { mstore(a, _1) }
// sstore(_1, 1)
// let b_1 := 10
// for { } iszero(b_1) { b_1 := add(b_1, not(0)) }
// { mstore(a, _1) }
// sstore(_1, 1)
// let b_2 := 10
// for { } iszero(b_2) { b_2 := add(b_2, not(0)) }
// { mstore(a, _1) }
// sstore(_1, 1)
// }
// }

View File

@ -20,17 +20,13 @@
// {
// {
// let _1 := sload(32)
// let x, y, z := foo_24_75(sload(0), _1)
// sstore(0, x)
// sstore(0, y)
// sstore(0, z)
// let x_1, y_1, z_1 := foo_24_75(_1, sload(8))
// }
// function foo_24_75(a, b) -> out1, out2, out3
// {
// let out1 := sload(mload(32))
// extcodecopy(out1, out1, 1, _1)
// sstore(0, out1)
// sstore(0, add(out1, 1))
// sstore(0, 0)
// let _2 := sload(8)
// let out1_1 := sload(mload(32))
// extcodecopy(out1_1, out1_1, 1, b)
// out1 := out1_1
// out2 := add(out1_1, 1)
// extcodecopy(out1_1, out1_1, 1, _2)
// }
// }