Detect loops in call graph generator.

This commit is contained in:
chriseth
2019-12-03 21:38:20 +01:00
parent 287b9be7af
commit bbeb093abf
13 changed files with 169 additions and 29 deletions
@@ -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()
// }
// }
@@ -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()
// }
// }