forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Detect loops in call graph generator.
- Loading branch information
Showing
13 changed files
with
169 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
function f() -> x { x := g() } | ||
function g() -> x { for {} 1 {} {} } | ||
pop(f()) | ||
} | ||
// ---- | ||
// : | ||
// f: | ||
// g: |
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
24 changes: 24 additions & 0 deletions
24
test/libyul/yulOptimizerTests/fullSuite/no_move_loop_orig.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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
for {} msize() { | ||
function foo_s_0() -> x_1 { for {} caller() {} {} } | ||
// x_3 used to be a movable loop invariant because `foo_s_0()` used to be movable | ||
let x_3 := foo_s_0() | ||
mstore(192, x_3) | ||
} | ||
{} | ||
} | ||
// ==== | ||
// step: fullSuite | ||
// ---- | ||
// { | ||
// { | ||
// for { } | ||
// 1 | ||
// { | ||
// for { } iszero(iszero(caller())) { } | ||
// { } | ||
// mstore(192, 0) | ||
// } | ||
// { if iszero(msize()) { break } } | ||
// } | ||
// } |
29 changes: 29 additions & 0 deletions
29
test/libyul/yulOptimizerTests/loopInvariantCodeMotion/no_move_loop.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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
{ | ||
function f() -> x { x := g() } | ||
function g() -> x { for {} 1 {} {} } | ||
|
||
let b := 1 | ||
for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) } { | ||
let t := f() | ||
let q := g() | ||
} | ||
} | ||
// ==== | ||
// step: loopInvariantCodeMotion | ||
// ---- | ||
// { | ||
// function f() -> x | ||
// { x := g() } | ||
// function g() -> x_1 | ||
// { | ||
// for { } 1 { } | ||
// { } | ||
// } | ||
// let b := 1 | ||
// let a := 1 | ||
// for { } iszero(eq(a, 10)) { a := add(a, 1) } | ||
// { | ||
// let t := f() | ||
// let q := g() | ||
// } | ||
// } |
26 changes: 26 additions & 0 deletions
26
test/libyul/yulOptimizerTests/loopInvariantCodeMotion/no_move_recursive_function.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
function f() -> x { x := g() } | ||
function g() -> x { x := g() } | ||
|
||
let b := 1 | ||
for { let a := 1 } iszero(eq(a, 10)) { a := add(a, 1) } { | ||
let t := f() | ||
let q := g() | ||
} | ||
} | ||
// ==== | ||
// step: loopInvariantCodeMotion | ||
// ---- | ||
// { | ||
// function f() -> x | ||
// { x := g() } | ||
// function g() -> x_1 | ||
// { x_1 := g() } | ||
// let b := 1 | ||
// let a := 1 | ||
// for { } iszero(eq(a, 10)) { a := add(a, 1) } | ||
// { | ||
// let t := f() | ||
// let q := g() | ||
// } | ||
// } |