Skip to content

Commit

Permalink
ssa: fix abi map init
Browse files Browse the repository at this point in the history
  • Loading branch information
visualfc committed Aug 6, 2024
1 parent 9ac0c06 commit 05a01cd
Show file tree
Hide file tree
Showing 5 changed files with 1,757 additions and 1,425 deletions.
10 changes: 6 additions & 4 deletions cl/_testgo/equal/out.ll
Original file line number Diff line number Diff line change
Expand Up @@ -543,10 +543,12 @@ _llgo_0:

define void @"main.init#7"() {
_llgo_0:
%0 = load ptr, ptr @"map[_llgo_int]_llgo_string", align 8
%1 = call ptr @"github.com/goplus/llgo/internal/runtime.MakeMap"(ptr %0, i64 0)
%2 = icmp ne ptr %1, null
call void @main.assert(i1 %2)
%0 = load ptr, ptr @_llgo_int, align 8
%1 = load ptr, ptr @_llgo_string, align 8
%2 = load ptr, ptr @"map[_llgo_int]_llgo_string", align 8
%3 = call ptr @"github.com/goplus/llgo/internal/runtime.MakeMap"(ptr %2, i64 0)
%4 = icmp ne ptr %3, null
call void @main.assert(i1 %4)
call void @main.assert(i1 true)
ret void
}
Expand Down
13 changes: 13 additions & 0 deletions cl/_testrt/makemap/in.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ func main() {
make4()
make5()
make6()
make7()
}

func make1() {
Expand Down Expand Up @@ -113,3 +114,15 @@ func make6() {
println(k, v)
}
}

func make7() {
type N int
m := map[N]string{
1: "hello",
2: "world",
}
for k, v := range m {
println(k, v)
}
println(m[1])
}
Loading

0 comments on commit 05a01cd

Please sign in to comment.