A. Ll file, written by hand, looks fine, but actually violates the SSA

; factorial.ll

define i32 @factorial(i32 %val) {
entry:
    %i = add i32 0, 2
    %temp = add i32 0, 1
    br label %check_for_condition

check_for_condition:
    %i_leq_val = icmp sle i32 %i, %val
    br i1 %i_leq_val, label %for_body, label %end_loop

for_body:
    %temp = mul i32 %temp, %i
    %i = add i32 %i, 1
    br label %check_for_condition

end_loop:
    ret i32 %temp
}
Copy the code

Use lli to execute the LL intermediate representation file.

$ lli factorial.ll 
lli: factorial.ll:14:5: error: multiple definition of local value named 'temp'
    %temp = mul i32 %temp, %i
Copy the code

To understand SSA from this example, %temp is assigned several times.