Repository: go
Issue: gollvm: llvm-goc crashes when enable-gc is set, with error "gc.statepoint callee argument must have elementtype attribute"
Labels: NeedsInvestigation


### What version of Go are you using (`go version`)?

<pre>
$ go version
go version unknown linux/amd64

</pre>

### Does this issue reproduce with the latest release?

Yes

### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
$ go env

</pre></details>

### What did you do?

main.go
<pre>
package main

import "fmt"

func main() {
        fmt.Println("hello world")
}
</pre>
compile main.go with `llvm-goc -O2 -enable-gc=1 -c main.go` command


### What did you expect to see?

No error, successful build.

### What did you see instead?

<pre>
hanchaoqun@DESKTOP-EUUIBGL:/mnt/d/golang/gopath/src/helloworld$ llvm-goc -O2 -enable-gc=1 -c main.go
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token = invoke token (i64, i32, void (i8 addrspace(1)*, i64, i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8i64p1i8f(i64 0, i32 0, void (i8 addrspace(1)*, i64, i8 addrspace(1)*)* @runtime.registerTypeDescriptors, i32 3, i32 0, i8 addrspace(1)* undef, i64 38, i8 addrspace(1)* bitcast ([38 x { i64, [1 x i8 addrspace(1)*] } addrspace(1)*] addrspace(1)* @go..typelists to i8 addrspace(1)*), i32 0, i32 0) [ "deopt"() ]
          to label %.noexc unwind label %dummy, !dbg !96
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token62 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 1, i32 0, void (i8 addrspace(1)*)* @internal_1cpu..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc3 unwind label %dummy1
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token64 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 2, i32 0, void (i8 addrspace(1)*)* @unicode..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc6 unwind label %dummy4
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token66 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 3, i32 0, void (i8 addrspace(1)*)* @math..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc9 unwind label %dummy7
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token68 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 4, i32 0, void (i8 addrspace(1)*)* @runtime..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc12 unwind label %dummy10
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token70 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 5, i32 0, void (i8 addrspace(1)*)* @internal_1reflectlite..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc15 unwind label %dummy13
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token72 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 6, i32 0, void (i8 addrspace(1)*)* @sync..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc18 unwind label %dummy16
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token74 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 7, i32 0, void (i8 addrspace(1)*)* @errors..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc21 unwind label %dummy19
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token76 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 8, i32 0, void (i8 addrspace(1)*)* @sort..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc24 unwind label %dummy22
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token78 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 9, i32 0, void (i8 addrspace(1)*)* @internal_1testlog..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc27 unwind label %dummy25
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token80 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 10, i32 0, void (i8 addrspace(1)*)* @io..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc30 unwind label %dummy28
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token82 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 11, i32 0, void (i8 addrspace(1)*)* @internal_1oserror..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc33 unwind label %dummy31
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token84 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 12, i32 0, void (i8 addrspace(1)*)* @path..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc36 unwind label %dummy34
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token86 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 13, i32 0, void (i8 addrspace(1)*)* @strconv..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc39 unwind label %dummy37
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token88 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 14, i32 0, void (i8 addrspace(1)*)* @reflect..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc42 unwind label %dummy40
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token90 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 15, i32 0, void (i8 addrspace(1)*)* @syscall..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc45 unwind label %dummy43
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token92 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 16, i32 0, void (i8 addrspace(1)*)* @time..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc48 unwind label %dummy46
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token94 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 17, i32 0, void (i8 addrspace(1)*)* @io_1fs..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc51 unwind label %dummy49
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token96 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 18, i32 0, void (i8 addrspace(1)*)* @internal_1poll..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc54 unwind label %dummy52
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token98 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 19, i32 0, void (i8 addrspace(1)*)* @os..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc57 unwind label %dummy55
gc.statepoint callee argument must have elementtype attribute
  %statepoint_token100 = invoke token (i64, i32, void (i8 addrspace(1)*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidp1i8f(i64 20, i32 0, void (i8 addrspace(1)*)* @fmt..import, i32 1, i32 0, i8 addrspace(1)* undef, i32 0, i32 0) [ "deopt"() ]
          to label %.noexc60 unwind label %dummy58
in function __go_init_main
LLVM ERROR: Broken function found, compilation aborted!
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
llvm-goc(+0x332fe7c)[0x55b9c48c7e7c]
llvm-goc(+0x332ff33)[0x55b9c48c7f33]
llvm-goc(+0x332dbe2)[0x55b9c48c5be2]
llvm-goc(+0x332f7fd)[0x55b9c48c77fd]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x12980)[0x7f81fd403980]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0xc7)[0x7f81fc4fbe87]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x141)[0x7f81fc4fd7f1]
llvm-goc(+0x3256a95)[0x55b9c47eea95]
llvm-goc(+0x325688c)[0x55b9c47ee88c]
llvm-goc(+0x30bd1b2)[0x55b9c46551b2]
llvm-goc(+0x2fd7808)[0x55b9c456f808]
llvm-goc(+0x2fd7ab1)[0x55b9c456fab1]
llvm-goc(+0x2fd7ed9)[0x55b9c456fed9]
llvm-goc(+0x2fd2efb)[0x55b9c456aefb]
llvm-goc(+0x2fd8763)[0x55b9c4570763]
llvm-goc(+0x901167)[0x55b9c1e99167]
llvm-goc(+0x8fd7fb)[0x55b9c1e957fb]
llvm-goc(+0x901310)[0x55b9c1e99310]
llvm-goc(+0x8f0a04)[0x55b9c1e88a04]
llvm-goc(+0x8f0bc7)[0x55b9c1e88bc7]
llvm-goc(+0x8e427c)[0x55b9c1e7c27c]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x7f81fc4dec87]
llvm-goc(+0x8e366a)[0x55b9c1e7b66a]
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: llvm-goc -O2 -enable-gc=1 -c main.go
1.      Running pass 'Function Pass Manager' on module 'gomodule'.
2.      Running pass 'Module Verifier' on function '@__go_init_main'
Aborted
</pre>