Skip to content

cmd/compile: Unnecessary copies of local variables in equality checks #59655

@merykitty

Description

@merykitty

Does this issue reproduce with the latest release?

Yes

What did you do?

https://godbolt.org/z/snnP3KWv7

What did you expect to see?

The 2 functions should do the same and just take the addresses of the local variables to invoke type..eq."".Bar.

What did you see instead?

The naive one creates 2 temporaries, then takes the addresses of those to invoke type..eq."".Bar, while the *& version does the expected operations.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions