You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1008 B

source_filename = "while_test.sy"
target triple = "x86_64-pc-linux-gnu"
@a = dso_local global i32 0, align 4
@b = dso_local global i32 0, align 4
define dso_local i32 @main() #0 {
store i32 0, i32* @b, align 4
store i32 3, i32* @a, align 4
br label %1
1:;preds = %5, %0
%2 = load i32, i32* @a, align 4;a
%3 = load i32, i32* @b, align 4;b
%4 = icmp sgt i32 %2, 0;a > 0 ?
br i1 %4, label %5, label %10
5:;preds = %1
%6 = load i32, i32* @a, align 4;a
%7 = load i32, i32* @b, align 4;b
%8 = add nsw i32 %6, %7;b + a
store i32 %8, i32* @b, align 4
%9 = sub nsw i32 %6, 1;a - 1
store i32 %9, i32* @a, align 4
br label %1
10:;preds = %1
%11 = load i32, i32* @b, align 4;b
ret i32 %11
}
attributes #0 = { noinline nounwind optnone uwtable "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }