mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add structural simplifier as optimization step for Yul.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
{ let a := mload(0) if a {} }
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// let a := mload(0)
|
||||
// pop(a)
|
||||
// }
|
||||
@@ -0,0 +1,6 @@
|
||||
{ if mload(0) {} }
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// pop(mload(0))
|
||||
// }
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
for { let a := 42 } 0 { a := a } {
|
||||
let b := a
|
||||
}
|
||||
}
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// let a := 42
|
||||
// }
|
||||
@@ -0,0 +1,5 @@
|
||||
{ if 0 { mstore(0, 0) } }
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// }
|
||||
@@ -0,0 +1,6 @@
|
||||
{ if 1 { mstore(0, 0) } }
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// mstore(0, 0)
|
||||
// }
|
||||
@@ -0,0 +1,6 @@
|
||||
{ if 1 { if 1 { for { mstore(0, 0) } 0 {} { mstore(2, 3) } if 0 { mstore(1, 2) } } } }
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// mstore(0, 0)
|
||||
// }
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
switch mload(0) default { mstore(1, 2) }
|
||||
}
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// pop(mload(0))
|
||||
// {
|
||||
// mstore(1, 2)
|
||||
// }
|
||||
// }
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
switch 1 case 2 { mstore(0, 0) }
|
||||
}
|
||||
// ----
|
||||
// structuralSimplifier
|
||||
// {
|
||||
// if eq(2, 1)
|
||||
// {
|
||||
// mstore(0, 0)
|
||||
// }
|
||||
// }
|
||||
Reference in New Issue
Block a user