Open
Description
This test case:
func foo(x: Int, y: Int)->Int {
var sum: Int
if (x >= y)
return 0
sum = 0;
while (x < y) {
if (x / 2 * 2 == x) {
sum = sum + 1
}
x = x + 1
}
return sum
}
Generates:
After SSA
=========
L0:
arg x_0
arg y_0
%t3_0 = x_0>=y_0
if %t3_0 goto L2 else goto L3
L2:
ret 0
goto L1
L1:
sum_4 = phi(sum_1, sum_1)
x_3 = phi(x_1, x_1)
L3:
sum_0 = 0
goto L4
L4:
sum_1 = phi(sum_0, sum_3)
x_1 = phi(x_0, x_2)
%t4_0 = x_1<y_0
if %t4_0 goto L5 else goto L6
L5:
%t5_0 = x_1/2
%t6_0 = %t5_0*2
%t7_0 = %t6_0==x_1
if %t7_0 goto L7 else goto L8
L7:
%t8_0 = sum_1+1
sum_2 = %t8_0
goto L8
L8:
sum_3 = phi(sum_1, sum_2)
%t9_0 = x_1+1
x_2 = %t9_0
goto L4
L6:
ret sum_1
goto L1