forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#12262 from ethereum/functionGrouper
Keep canonical form of Yul during optimization.
- Loading branch information
Showing
169 changed files
with
936 additions
and
652 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
{ | ||
let _1 := mload(0) | ||
let f_a := mload(1) | ||
let f_r | ||
{ | ||
f_a := mload(f_a) | ||
f_r := add(f_a, calldatasize()) | ||
let _1 := mload(0) | ||
let f_a := mload(1) | ||
let f_r | ||
{ | ||
f_a := mload(f_a) | ||
f_r := add(f_a, calldatasize()) | ||
} | ||
let z := mload(2) | ||
} | ||
let z := mload(2) | ||
} | ||
// ---- | ||
// step: blockFlattener | ||
// | ||
// { | ||
// let _1 := mload(0) | ||
// let f_a := mload(1) | ||
// let f_r | ||
// f_a := mload(f_a) | ||
// f_r := add(f_a, calldatasize()) | ||
// let z := mload(2) | ||
// { | ||
// let _1 := mload(0) | ||
// let f_a := mload(1) | ||
// let f_r | ||
// f_a := mload(f_a) | ||
// f_r := add(f_a, calldatasize()) | ||
// let z := mload(2) | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
{ | ||
for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) } { | ||
a := add(a, 1) | ||
{ | ||
for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) } { | ||
a := add(a, 1) | ||
} | ||
} | ||
} | ||
// ---- | ||
// step: blockFlattener | ||
// | ||
// { | ||
// for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) } | ||
// { a := add(a, 1) } | ||
// { | ||
// for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) } | ||
// { a := add(a, 1) } | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,25 @@ | ||
{ | ||
if add(mload(7), sload(mload(3))) | ||
{ | ||
let y := add(mload(3), 3) | ||
{ | ||
y := add(y, 7) | ||
} | ||
if add(mload(7), sload(mload(3))) | ||
{ | ||
let y := add(mload(3), 3) | ||
{ | ||
y := add(y, 7) | ||
} | ||
} | ||
let t := add(3, 9) | ||
} | ||
let t := add(3, 9) | ||
} | ||
// ---- | ||
// step: blockFlattener | ||
// | ||
// { | ||
// if add(mload(7), sload(mload(3))) | ||
// { | ||
// let y := add(mload(3), 3) | ||
// y := add(y, 7) | ||
// if add(mload(7), sload(mload(3))) | ||
// { | ||
// let y := add(mload(3), 3) | ||
// y := add(y, 7) | ||
// } | ||
// let t := add(3, 9) | ||
// } | ||
// let t := add(3, 9) | ||
// } |
38 changes: 21 additions & 17 deletions
38
test/libyul/yulOptimizerTests/blockFlattener/many_nested_blocks.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,33 @@ | ||
{ | ||
let a := 3 | ||
let b := 4 | ||
{ | ||
a := add(b, 3) | ||
let c := 5 | ||
let a := 3 | ||
let b := 4 | ||
{ | ||
b := add(b, 4) | ||
a := add(b, 3) | ||
let c := 5 | ||
{ | ||
c := add(a, 5) | ||
} | ||
b := add(a, b) | ||
b := add(b, 4) | ||
{ | ||
c := add(a, 5) | ||
} | ||
b := add(a, b) | ||
} | ||
a := add(a, c) | ||
} | ||
a := add(a, c) | ||
} | ||
} | ||
// ---- | ||
// step: blockFlattener | ||
// | ||
// { | ||
// let a := 3 | ||
// let b := 4 | ||
// a := add(b, 3) | ||
// let c := 5 | ||
// b := add(b, 4) | ||
// c := add(a, 5) | ||
// b := add(a, b) | ||
// a := add(a, c) | ||
// { | ||
// let a := 3 | ||
// let b := 4 | ||
// a := add(b, 3) | ||
// let c := 5 | ||
// b := add(b, 4) | ||
// c := add(a, 5) | ||
// b := add(a, b) | ||
// a := add(a, c) | ||
// } | ||
// } |
24 changes: 14 additions & 10 deletions
24
test/libyul/yulOptimizerTests/blockFlattener/switch_stmt.yul
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,27 @@ | ||
{ | ||
{ | ||
let a := 1 | ||
switch calldataload(0) | ||
case 0 { { { mstore(0, 1) } } a := 8 } | ||
default { a := 3 { a := 4 } } | ||
a := 5 | ||
} | ||
} | ||
// ---- | ||
// step: blockFlattener | ||
// | ||
// { | ||
// let a := 1 | ||
// switch calldataload(0) | ||
// case 0 { | ||
// mstore(0, 1) | ||
// a := 8 | ||
// { | ||
// let a := 1 | ||
// switch calldataload(0) | ||
// case 0 { | ||
// mstore(0, 1) | ||
// a := 8 | ||
// } | ||
// default { | ||
// a := 3 | ||
// a := 4 | ||
// } | ||
// a := 5 | ||
// } | ||
// default { | ||
// a := 3 | ||
// a := 4 | ||
// } | ||
// a := 5 | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
// ---- | ||
// step: circularReferencesPruner | ||
// | ||
// { } | ||
// { { } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
// ---- | ||
// step: circularReferencesPruner | ||
// | ||
// { } | ||
// { { } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
// ---- | ||
// step: circularReferencesPruner | ||
// | ||
// { } | ||
// { { } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.