Skip to content

cmd/compile: jump table optimisation is not utilised when a case has multiple clauses #56253

Closed
@renthraysk

Description

@renthraysk

What version of Go are you using (go version)?

$ go version
go version go1.19.2 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

https://go.dev/play/p/LSrP_ch-8f1

What did you expect to see?

Both f1() & f2() to utilize jump table optimization, as both functions are functionally identical.

What did you see instead?

f1() uses jump table optimization as it has 8 distinct case clauses.
f2() reverts to a chain of comparisons.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions