A naming issue in Koopa to LLVM IR generator.
MaxXSoft opened this issue · comments
When both %0
and @_0
symbol definitions are present in Koopa, the generated LLVM IR file may contain duplicate symbol definitions.
hello.koopa:
fun @main(): i32 {
%entry:
@a = alloc i32
%0 = add 0, 1
store %0, @a
@b = alloc i32
%1 = add 0, 0
store %1, @b
%2 = load @a
%3 = load @b
%4 = ne %2, 0
%5 = ne %3, 0
%6 = or %4, %5
br %6, %then_0, %end_0
%then_0:
%7 = add 0, 1
%8 = load @b
store %7, @b
%9 = add 0, 0
%10 = load @a
store %9, @a
jump %end_0
%end_0:
%11 = load @a
@_0 = alloc i32
br %11, %then_1, %else_1
%then_1:
%12 = load @b
%13 = ne %12, 0
store %13, @_0
jump %end_1
%else_1:
store 0, @_0
jump %end_1
%end_1:
%14 = load @_0
br %14, %then_2, %end_2
%then_2:
%15 = add 0, 0
ret %15
%end_2:
%16 = add 0, 77
ret %16
}
test.koopa:
global @y_1 = alloc i32, 3
fun @main(): i32 {
%entry:
%0 = add 1, 2
@_0 = add %0, 1
ret @_0
}