cmd/compile: flashing optimization indexing into arrays bounded by a modulo bellow or equal to the length only works if the modulo is a sub expression of the indexing #63110
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
NeedsFix
The path to resolution is known, but the work has not been done.
Performance
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Compile:
What did you expect to see?
No bound check
What did you see instead?
A bound check is present.
However this:
correctly omits the bound check.
Why is this broken ?
Fails to be picked up by prove because opt rewrites it to something along the lines of:
which it has no idea what to do with.
arr[x % 100]
is specially handled withinternal/ir
.I think a simple enough fix is to delay strength reduction to late opt (except for powers of two since prove knows how to handle theses), this will make it miss the main CSE passes but I don't think it's that bad, there is still lowered cse, need to experiment and see what this yields.
The text was updated successfully, but these errors were encountered: