-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: missing bounds check elimination for complex conditionals #72132
Comments
I think that's just a line numbering problem. There are bounds checks in all the examples. |
@randall77 There are bounds checks in all examples, but (unless I'm missing something) double the amount in the
|
Ah, ok, I see it now. Somehow the bounds checks in the loop condition are not making the bounds checks in the swap line redundant. I suspect this has something to do with the Note this has nothing to do with generics, replacing |
Here's a simpler reproducer:
This has 2 bounds checks. Remove |
@randall77 Thanks! Glad I'm not hallucinating. 😌 |
By looking at the discussion, this looks like WAI, closing |
@JunyangShao What? No... Edit: Even though the problem appears unrelated to generics, this issue could be re-purposed to track down those spurious bounds checks (confirmed by @randall77 in #72132 (comment)). I'm not aware of any open issue about that. |
Please reopen the issue at this time. |
Go version
go version go1.24.1 darwin/amd64
Output of
go env
in your module/workspace:What did you do?
Run
go build -gcflags '-d=ssa/check_bce/debug=1'
on the following two programmes:What did you see happen?
The first programme has no bounds checks on the swap line:
Surprisingly, the second programme has two bounds checks on the swap line:
What did you expect to see?
Given the absence of any type switch on
insertionSortOrdered
's type parameter, I expected the number of bounds checks to be insensitive to the choice of type argument.The text was updated successfully, but these errors were encountered: