cmd/compile: teach BCE about min
builtin
#68553
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
Uh oh!
There was an error while loading. Please reload this page.
Go version
go version go1.22.5 linux/amd64
Output of
go env
in your module/workspace:What did you do?
https://go.dev/play/p/wE9DX4D3Iga
https://go.godbolt.org/z/11PYfc6x3
What did you see happen?
Bound checks are not eliminated.
What did you expect to see?
Given that
min(len(x), len(y))
is non-negative and less or equal thanlen(x)
andlen(y)
,i
is always in bounds of both slices, so bounds checks could be eliminated.Iteration patterns like this are quite common, especially in columnar data formats.
The text was updated successfully, but these errors were encountered: