Skip to content

Commit b852d54

Browse files
committed
test code motion
1 parent a1d694f commit b852d54

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

test-out/epfl/test7-codemotion5.check

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
/*****************************************
22
Emitting Generated Code
33
*******************************************/
4-
class Test extends ((Unit)=>(Any)) {
5-
def apply(x0:Unit): Any = {
6-
val x6 = if (true) {
4+
class Test extends ((Unit)=>(scala.Function1[Double, Unit])) {
5+
def apply(x0:Unit): scala.Function1[Double, Unit] = {
6+
val x8 = if (true) {
77
val x2 = 7.0 + 9.0
88
val x5 = {x1: (Double) =>
99
val x3 = println(x2)
1010
x3: Unit
1111
}
1212
x5
1313
} else {
14-
()
14+
val x7 = {x6: (Double) =>
15+
(): Unit
1516
}
16-
x6
17+
x7
18+
}
19+
x8
1720
}
1821
}
1922
/*****************************************

test-out/epfl/test7-codemotion7.check

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
11
/*****************************************
22
Emitting Generated Code
33
*******************************************/
4-
class Test extends ((Unit)=>(scala.Function1[Double, Any])) {
5-
def apply(x0:Unit): scala.Function1[Double, Any] = {
6-
val x8 = {x1: (Double) =>
4+
class Test extends ((Unit)=>(scala.Function1[Double, scala.Function1[Double, Double]])) {
5+
def apply(x0:Unit): scala.Function1[Double, scala.Function1[Double, Double]] = {
6+
val x8 = {x7: (Double) =>
7+
x7: Double
8+
}
9+
val x10 = {x1: (Double) =>
710
val x2 = x1 < 100.0
8-
val x7 = if (x2) {
11+
val x9 = if (x2) {
912
val x3 = x1 + 9.0
1013
val x6 = {x4: (Double) =>
1114
val x5 = x3 + x4
1215
x5: Double
1316
}
1417
x6
1518
} else {
16-
()
19+
x8
1720
}
18-
x7: Any
21+
x9: scala.Function1[Double, Double]
1922
}
20-
x8
23+
x10
2124
}
2225
}
2326
/*****************************************

test-src/epfl/test7-analysis/TestCodeMotion.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ trait NestCondProg5 extends BooleanOps with PrimitiveOps with Functions with IfT
100100
print(unit(7.0) + unit(9.0))
101101
}
102102
} else {
103-
???
103+
doLambda { u: Rep[Double] => } // dummy
104104
}
105105
}
106106

@@ -136,7 +136,7 @@ trait NestCondProg7 extends LiftAll with BooleanOps with PrimitiveOps with Order
136136
z + u
137137
}
138138
} else {
139-
???
139+
doLambda { u: Rep[Double] => u} // dummy
140140
}
141141
}
142142
}

0 commit comments

Comments
 (0)