10BC0 cmd/compile: changing a hot concrete method to interface method triggers a PGO ICE · Issue #67016 · golang/go · GitHub
[go: up one dir, main page]

Skip to content

cmd/compile: changing a hot concrete method to interface method triggers a PGO ICE #67016

@prattmic

Description

@prattmic

Go version

go version go1.22.2 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/usr/local/google/home/mpratt/.cache/go-build'
GOENV='/usr/local/google/home/mpratt/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/usr/local/google/home/mpratt/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/usr/local/google/home/mpratt/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/google/home/mpratt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.linux-amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='go1.22.2'
GOTOOLDIR='/usr/local/google/home/mpratt/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.2.linux-amd64/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.2'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/usr/local/google/home/mpratt/Downloads/b336740241_pgo_ice/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2161017047=/tmp/go-build -gno-record-gcc-switches'

What did you do?

Run this program to generate /tmp/cpu.pprof:

package main

import (
        "os"
        "runtime/pprof"
)

type Type struct{}

var sink int

//go:noinline
func (Type) Method() {
        for range 10000000 {
                sink++
        }
}

func main() {
        f, _ := os.Create("/tmp/cpu.pprof")
        defer f.Close()
        pprof.StartCPUProfile(f)
        defer pprof.StopCPUProfile()

        var t Type
        t.Method()
}

Now change Type to an interface type. For example:

package main

import (
        "os"
        "runtime/pprof"
)

type Type interface{
        Method()
}

type Type2 struct{}

var sink int

//go:noinline
func (Type2) Method() {
        for i := 0; i < 10000000; i++ {
                sink++
        }
}

func main() {
        f, _ := os.Create("/tmp/cpu.pprof")
        defer f.Close()
        pprof.StartCPUProfile(f)
        defer pprof.StopCPUProfile()

        var t Type2
        t.Method()
}

Then build with PGO:

$ go build -pgo=/tmp/cpu.pprof

What did you see happen?

$ go build -pgo /tmp/cpu.pprof
# example.com/ice                                                     
./main.go:23:6: internal compiler error: panic: interface conversion: types.Object is nil, not *ir.Name
                                                                      
Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new

What did you expect to see?

No ICE

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0