cmd/compile: inlined err check elimination opportunity #42999
Labels
Milestone
Comments
Could be related to #17862 |
There's a recombination of control flow happening here that the compiler isn't currently able to disentangle.
This should certainly be optimizable. Try patching in https://go-review.googlesource.com/c/go/+/239457 , it may just be that optimization. But maybe not quite, because there's one pesky instruction in one of the branches that needs to be lifted first? At the fuse pass, we have
The |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: