-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/compile: opt: eliminate redundant cap check #71246
Comments
cc @golang/compiler |
If
The real question is why this has a write barrier. |
Ah, of course, the first slice operation isn't an error. Sorry for the dumb question, and thanks for the detailed explanation.
Hah, I didn't even notice that. |
I think I was thinking of But still, we should do |
While investigating a crash in gopls, I noticed that the assembly for this function contains what appears to be a redundant check of
n <= cap(r.data)
:Why is the cap check needed? It is immediately followed by a similar check against r.data.len, which should (it seems to me) suffice. Perhaps we could optimize it out.
The text was updated successfully, but these errors were encountered: