cmd/compile: inlined err check elimination opportunity #42999
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
I realized that there is a
if err != nil
branch elimination possibility after inlined func.With go tip 2c2980a, the following code (https://go.godbolt.org/z/sx5Gr9):
This is compiled into:
If I manually do the transform, the code ends up looking like:
Which, in assembly is:
I'm not sure for how many
err != nil
it would be possible, however, already for a few, it should improve things.When creating the err inside the func, it's able to remove the branch:
Compiles into:
The text was updated successfully, but these errors were encountered: