cmd/compile: loops prevent bounds checking elimination #40704
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
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
If I do some copies between arrays with a loop like:
it bounds check on each array on every iteration.
but if I unroll it, it can figure out that it will never go out of bounds and eliminate the checks:
godbolt: https://godbolt.org/z/E3c5r4
This means that when implementing performance critical code (ie cryptography) I find myself unrolling loops of 8-16 because they end up on pprof which really sucks for readability
The text was updated successfully, but these errors were encountered: