Skip to content

Commit 3b12690

Browse files
#57 Update test
1 parent fbb9479 commit 3b12690

File tree

1 file changed

+69
-2
lines changed

1 file changed

+69
-2
lines changed

optvm/src/test/java/com/compilerprogramming/ezlang/compiler/TestSSADestructB.java

Lines changed: 69 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,8 +1077,40 @@ public void testLostCopyProblem() {
10771077
ret x2
10781078
""";
10791079
Assert.assertEquals(expected, function.toStr(new StringBuilder(), false).toString());
1080+
var sb = new StringBuilder();
1081+
function.setDumpTarget(sb);
10801082
new ExitSSA(function, ssaExitOptions);
10811083
expected = """
1084+
After converting from SSA to CSSA
1085+
L0:
1086+
arg p
1087+
x1 = 1
1088+
(%t4) = (x1)
1089+
goto L2
1090+
L2:
1091+
%t6 = phi(%t4, %t5)
1092+
(x2) = (%t6)
1093+
x3 = x2+1
1094+
(%t5) = (x3)
1095+
if p goto L2 else goto L1
1096+
L1:
1097+
ret x2
1098+
After removing phis from CSSA
1099+
L0:
1100+
arg p
1101+
x1 = 1
1102+
(%t4) = (x1)
1103+
%t6 = %t4
1104+
goto L2
1105+
L2:
1106+
(x2) = (%t6)
1107+
x3 = x2+1
1108+
(%t5) = (x3)
1109+
%t6 = %t5
1110+
if p goto L2 else goto L1
1111+
L1:
1112+
ret x2
1113+
After sequencing parallel copies
10821114
L0:
10831115
arg p
10841116
x1 = 1
@@ -1094,7 +1126,8 @@ public void testLostCopyProblem() {
10941126
L1:
10951127
ret x2
10961128
""";
1097-
Assert.assertEquals(expected, function.toStr(new StringBuilder(), false).toString());
1129+
sb.append("After sequencing parallel copies\n");
1130+
Assert.assertEquals(expected, function.toStr(sb, false).toString());
10981131
}
10991132

11001133
/**
@@ -1150,8 +1183,41 @@ public void testSwapProblem() {
11501183
L1:
11511184
""";
11521185
Assert.assertEquals(expected, function.toStr(new StringBuilder(), false).toString());
1186+
var sb = new StringBuilder();
1187+
function.setDumpTarget(sb);
11531188
new ExitSSA(function, ssaExitOptions);
11541189
expected = """
1190+
After converting from SSA to CSSA
1191+
L0:
1192+
arg p
1193+
a1 = 42
1194+
b1 = 24
1195+
(%t5,%t8) = (a1,b1)
1196+
goto L2
1197+
L2:
1198+
%t7 = phi(%t5, %t6)
1199+
%t10 = phi(%t8, %t9)
1200+
(a2,b2) = (%t7,%t10)
1201+
(%t6,%t9) = (b2,a2)
1202+
if p goto L2 else goto L1
1203+
L1:
1204+
After removing phis from CSSA
1205+
L0:
1206+
arg p
1207+
a1 = 42
1208+
b1 = 24
1209+
(%t5,%t8) = (a1,b1)
1210+
%t7 = %t5
1211+
%t10 = %t8
1212+
goto L2
1213+
L2:
1214+
(a2,b2) = (%t7,%t10)
1215+
(%t6,%t9) = (b2,a2)
1216+
%t7 = %t6
1217+
%t10 = %t9
1218+
if p goto L2 else goto L1
1219+
L1:
1220+
After sequencing parallel copies
11551221
L0:
11561222
arg p
11571223
a1 = 42
@@ -1171,7 +1237,8 @@ public void testSwapProblem() {
11711237
if p goto L2 else goto L1
11721238
L1:
11731239
""";
1174-
Assert.assertEquals(expected, function.toStr(new StringBuilder(), false).toString());
1240+
sb.append("After sequencing parallel copies\n");
1241+
Assert.assertEquals(expected, function.toStr(sb, false).toString());
11751242
}
11761243

11771244
@Test

0 commit comments

Comments
 (0)