Update UnusedFunctionParameterPruner tests to avoid getting inlined

This commit is contained in:
Harikrishnan Mulackal 2020-09-14 17:59:50 +02:00
parent 42c26e0bf5
commit b7944477a1
4 changed files with 53 additions and 52 deletions

View File

@ -10,6 +10,8 @@
out1 := sload(out1)
out2 := add(out1, 1)
extcodecopy(out1, out2, 1, b)
// to prevent foo from getting inlined
if iszero(out1) { leave }
}
}
// ----
@ -17,14 +19,16 @@
//
// {
// {
// let _1 := sload(32)
// let out1 := sload(mload(32))
// let out2 := add(out1, 1)
// extcodecopy(out1, out2, 1, _1)
// let out1, out2 := foo(sload(32))
// sstore(0, out1)
// sstore(0, out2)
// let _2 := sload(8)
// let out1_1 := sload(mload(32))
// extcodecopy(out1_1, add(out1_1, 1), 1, _2)
// let out1_1, out2_1 := foo(sload(8))
// }
// function foo(b) -> out1, out2
// {
// out1 := sload(mload(32))
// out2 := add(out1, 1)
// extcodecopy(out1, out2, 1, b)
// if iszero(out1) { leave }
// }
// }

View File

@ -7,6 +7,8 @@
{
a := calldataload(0)
mstore(a, x)
// to prevent f from getting inlined
if iszero(a) { leave }
}
}
}
@ -15,19 +17,23 @@
//
// {
// {
// f()
// sstore(0, 1)
// f()
// sstore(0, 1)
// f()
// sstore(0, 1)
// }
// function f()
// {
// let b := 10
// let _1 := 0
// let a := calldataload(_1)
// let _2 := iszero(a)
// for { } iszero(b) { b := add(b, not(0)) }
// { 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)
// {
// mstore(a, _1)
// if _2 { leave }
// }
// }
// }

View File

@ -12,6 +12,8 @@
out1 := sload(out1)
out2 := add(out1, 1)
extcodecopy(out1, out1, 1, b)
// to prevent foo from getting inlined
if iszero(out1) { leave }
}
}
// ----
@ -19,14 +21,17 @@
//
// {
// {
// let _1 := sload(32)
// let out1 := sload(mload(32))
// extcodecopy(out1, out1, 1, _1)
// let out1, out2 := foo(sload(32))
// sstore(0, out1)
// sstore(0, add(out1, 1))
// sstore(0, out2)
// sstore(0, 0)
// let _2 := sload(8)
// let out1_1 := sload(mload(32))
// extcodecopy(out1_1, out1_1, 1, _2)
// let out1_1, out2_1 := foo(sload(8))
// }
// function foo(b) -> out1, out2
// {
// out1 := sload(mload(32))
// out2 := add(out1, 1)
// extcodecopy(out1, out1, 1, b)
// if iszero(out1) { leave }
// }
// }

View File

@ -6,11 +6,8 @@
// The usage of a is redundant
a := calldataload(0)
mstore(a, x)
// to prevent getting fully inlined
sstore(1, 1)
sstore(2, 2)
sstore(3, 3)
sstore(3, 3)
// to prevent f from getting inlined
if iszero(a) { leave }
}
}
// ----
@ -18,28 +15,17 @@
//
// {
// {
// let _1 := 0
// let _2 := calldataload(_1)
// mstore(_2, _1)
// let _3 := 1
// sstore(_3, _3)
// let _4 := 2
// sstore(_4, _4)
// let _5 := 3
// sstore(_5, _5)
// sstore(_5, _5)
// sstore(_1, _3)
// mstore(_2, _1)
// sstore(_3, _3)
// sstore(_4, _4)
// sstore(_5, _5)
// sstore(_5, _5)
// sstore(_1, _3)
// mstore(_2, _1)
// sstore(_3, _3)
// sstore(_4, _4)
// sstore(_5, _5)
// sstore(_5, _5)
// sstore(_1, _3)
// f()
// sstore(0, 1)
// f()
// sstore(0, 1)
// f()
// sstore(0, 1)
// }
// function f()
// {
// let a := calldataload(0)
// mstore(a, 0)
// if iszero(a) { leave }
// }
// }