Skip to content

Commit b31e779 added a blocker to dead code elimination by the Go compiler #130201

Closed
@artem-anisimov-0x7f

Description

@artem-anisimov-0x7f

What happened?

Commit b31e779 by @p0lyn0mial uses cmp.Diff() which depends on reflect.Type.Method(n int). Upon encountering the use of this method, the go compiler disables the dead code elimination.

The commit message for b31e779 indicates that

The consistency check is meant to be enforced only in the CI, not in production.

Please fix the consistency check to disable the DCE only in CI, not in the production.

What did you expect to happen?

Debug code must not pessimise the code generation for prod environments.

How can we reproduce it (as minimally and precisely as possible)?

You can use go build -ldflags '-dumpdep' to have the compiler dump the dependency graph of linked symbols. Any symbol marked with <ReflectMethod> disables the DCE.

Anything else we need to know?

No response

Kubernetes version

b31e779

Cloud provider

any

OS version

No response

Install tools

No response

Container runtime (CRI) and version (if applicable)

No response

Related plugins (CNI, CSI, ...) and versions (if applicable)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.sig/api-machineryCategorizes an issue or PR as relevant to SIG API Machinery.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions