Skip to content

Commit

Permalink
Merge pull request #15658 from ipsilon/eof-update-yul-legacy-tests
Browse files Browse the repository at this point in the history
eof: Update yul legacy tests
  • Loading branch information
cameel authored Feb 3, 2025
2 parents 8d46c51 + c9466e5 commit f83e7d8
Show file tree
Hide file tree
Showing 83 changed files with 533 additions and 124 deletions.
2 changes: 2 additions & 0 deletions test/libyul/yulControlFlowGraph/ambiguous_names.yul
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
function b() {}
}
}
// ====
// bytecodeFormat: legacy
// ----
// digraph CFG {
// nodesep=0.7;
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulControlFlowGraph/complex.yul
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
}
pop(f(1,2))
}
// ====
// bytecodeFormat: legacy
// ----
// digraph CFG {
// nodesep=0.7;
Expand Down
67 changes: 67 additions & 0 deletions test/libyul/yulControlFlowGraph/eof/function.yul
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
function f(a, b) -> r {
let x := add(a,b)
r := sub(x,a)
}
function g() {
sstore(0x01, 0x0101)
}
function h(x) {
h(f(x, 0))
g()
}
function i() -> v, w {
v := 0x0202
w := 0x0303
}
let x, y := i()
h(x)
h(y)
}
// ====
// bytecodeFormat: >=EOFv1
// ----
// digraph CFG {
// nodesep=0.7;
// node[shape=box];
//
// Entry [label="Entry"];
// Entry -> Block0;
// Block0 [label="\
// i: [ ] => [ TMP[i, 0] TMP[i, 1] ]\l\
// Assignment(x, y): [ TMP[i, 0] TMP[i, 1] ] => [ x y ]\l\
// h: [ x ] => [ ]\l\
// "];
// Block0Exit [label="Terminated"];
// Block0 -> Block0Exit;
//
// FunctionEntry_f_1 [label="function f(a, b) -> r"];
// FunctionEntry_f_1 -> Block1;
// Block1 [label="\
// add: [ b a ] => [ TMP[add, 0] ]\l\
// Assignment(x): [ TMP[add, 0] ] => [ x ]\l\
// sub: [ a x ] => [ TMP[sub, 0] ]\l\
// Assignment(r): [ TMP[sub, 0] ] => [ r ]\l\
// "];
// Block1Exit [label="FunctionReturn[f]"];
// Block1 -> Block1Exit;
//
// FunctionEntry_h_2 [label="function h(x)"];
// FunctionEntry_h_2 -> Block2;
// Block2 [label="\
// f: [ 0x00 x ] => [ TMP[f, 0] ]\l\
// h: [ TMP[f, 0] ] => [ ]\l\
// "];
// Block2Exit [label="Terminated"];
// Block2 -> Block2Exit;
//
// FunctionEntry_i_3 [label="function i() -> v, w"];
// FunctionEntry_i_3 -> Block3;
// Block3 [label="\
// Assignment(v): [ 0x0202 ] => [ v ]\l\
// Assignment(w): [ 0x0303 ] => [ w ]\l\
// "];
// Block3Exit [label="FunctionReturn[i]"];
// Block3 -> Block3Exit;
//
// }
2 changes: 2 additions & 0 deletions test/libyul/yulControlFlowGraph/function.yul
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
h(x)
h(y)
}
// ====
// bytecodeFormat: legacy
// ----
// digraph CFG {
// nodesep=0.7;
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulControlFlowGraph/leave.yul
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

pop(f(0,1))
}
// ====
// bytecodeFormat: legacy
// ----
// digraph CFG {
// nodesep=0.7;
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulInterpreterTests/and_create.yul
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
let b := and(u160max, create(0, u160max, 0))
mstore(0, eq(a, b))
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// CREATE(0, 0, 0)
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulInterpreterTests/and_create2.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// Trace:
// CREATE2(0, 0, 0, 0)
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulInterpreterTests/create2.yul
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// Trace:
// CREATE2(0, 0, 32, 32)
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulInterpreterTests/datacopy.yul
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ object "main"
}
object "sub" { code { sstore(0, 1) } }
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// Memory dump:
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulInterpreterTests/dataoffset.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ object "main"
}
object "sub" { code { sstore(0, 1) } }
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// Memory dump:
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulInterpreterTests/datasize.yul
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ object "main"
}
object "sub" { code { sstore(0, 1) } }
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// Memory dump:
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulInterpreterTests/external_call_to_self.yul
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
}
// ====
// simulateExternalCall: true
// bytecodeFormat: legacy
// ----
// Trace:
// CALL(153, 0x11111111, 0, 64, 32, 256, 32)
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulInterpreterTests/external_call_unexecuted.yul
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
let x := call(gas(), 0x45, 0x5, 0, 0x20, 0x30, 0x20)
sstore(0x64, x)
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// CALL(153, 69, 5, 0, 32, 48, 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
let x := callcode(gas(), 0x45, 0x5, 0, 0x20, 0x30, 0x20)
sstore(100, x)
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// CALLCODE(153, 69, 5, 0, 32, 48, 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
let x := delegatecall(gas(), 0x45, 0, 0x20, 0x30, 0x20)
sstore(100, x)
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// DELEGATECALL(153, 69, 0, 32, 48, 32)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
}
// ====
// EVMVersion: >=byzantium
// bytecodeFormat: legacy
// ----
// Trace:
// STATICCALL(153, 69, 0, 32, 48, 32)
Expand Down
2 changes: 2 additions & 0 deletions test/libyul/yulInterpreterTests/long_object_name.yul
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ object "t" {
}
}
}
// ====
// bytecodeFormat: legacy
// ----
// Trace:
// Memory dump:
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulInterpreterTests/pop_byte_shr_call.yul
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// Trace:
// CALL(0, 0, 0, 0, 0, 0, 0)
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulInterpreterTests/side_effect_free.yul
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// Trace:
// Memory dump:
Expand Down
1 change: 1 addition & 0 deletions test/libyul/yulInterpreterTests/zero_length_reads.yul
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// Trace:
// RETURNDATACOPY(0, 1, 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
}
// ====
// EVMVersion: >=constantinople
// bytecodeFormat: legacy
// ----
// Trace:
// RETURNDATACOPY(0, 1, 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
let a := 1
let b := codesize()
for { } lt(1, codesize()) { mstore(1, codesize()) a := add(a, codesize()) } {
mstore(1, codesize())
let b := calldataload(0)
for { } lt(1, calldataload(0)) { mstore(1, calldataload(0)) a := add(a, calldataload(0)) } {
mstore(1, calldataload(0))
}
mstore(1, codesize())
mstore(1, calldataload(0))
}
// ----
// step: commonSubexpressionEliminator
//
// {
// let a := 1
// let b := codesize()
// let b := calldataload(0)
// for { }
// lt(1, b)
// {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ object "AccessControlDefaultAdminRules4233_14" {
data "AccessControlDefaultAdminRules4233_14_deployed" "AccessControlDefaultAdminRules4233_14_deployed"

}
// ====
// bytecodeFormat: legacy
// ----
// step: commonSubexpressionEliminator
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
let a := gas()
let b := gas()
}
// ====
// bytecodeFormat: legacy
// ----
// step: commonSubexpressionEliminator
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ object "main" {
}
data "abc" "Hello, World!"
}
// ====
// bytecodeFormat: legacy
// ----
// step: commonSubexpressionEliminator
//
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
let a := mul(1, codesize())
let b := mul(1, codesize())
let a := mul(1, calldataload(0))
let b := mul(1, calldataload(0))
}
// ----
// step: commonSubexpressionEliminator
//
// {
// let a := mul(1, codesize())
// let a := mul(1, calldataload(0))
// let b := a
// }
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ object "A" {
}
data 'abc' "1234"
}
// ====
// bytecodeFormat: legacy
// ----
// step: disambiguator
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
sstore(a, b)
if calldataload(32) {
sstore(a, b)
pop(staticcall(0, 0, 0, 0, 0, 0))
pop(sload(a))
sstore(a, b)
}
sstore(a, b)
Expand All @@ -18,8 +18,5 @@
// let a := calldataload(0)
// let b := 20
// sstore(a, b)
// if calldataload(32)
// {
// pop(staticcall(0, 0, 0, 0, 0, 0))
// }
// if calldataload(32) { pop(sload(a)) }
// }
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}

function g() {
pop(staticcall(0, 0, 0, 0, 0, 0))
pop(sload(calldataload(0)))
}

function h(a_, b_) {
Expand All @@ -21,7 +21,7 @@
}

function i() {
pop(delegatecall(0, 0, 0, 0, 0, 0))
sstore(calldataload(64), 42)
}


Expand All @@ -40,17 +40,13 @@
// g()
// }
// function g()
// {
// pop(staticcall(0, 0, 0, 0, 0, 0))
// }
// { pop(sload(calldataload(0))) }
// function h(a_, b_)
// {
// sstore(a_, b_)
// i()
// sstore(a_, b_)
// }
// function i()
// {
// pop(delegatecall(0, 0, 0, 0, 0, 0))
// }
// { sstore(calldataload(64), 42) }
// }
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
sstore(a, b)
if calldataload(32) {
sstore(a, b)
pop(staticcall(0, 0, 0, 0, 0, 0))
pop(sload(a))
verbatim_0i_0o("xyz")
}
sstore(a, b)
Expand All @@ -20,7 +20,7 @@
// sstore(a, b)
// if calldataload(32)
// {
// pop(staticcall(0, 0, 0, 0, 0, 0))
// pop(sload(a))
// verbatim_0i_0o("xyz")
// }
// sstore(a, b)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ object "test"
data 'A' "A"
}

// ====
// bytecodeFormat: legacy
// ----
// step: equivalentFunctionCombiner
//
Expand Down
Loading

0 comments on commit f83e7d8

Please sign in to comment.