cmd/compile: bounds check elimination thwarted by if-foruntil idiom #22236
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Performance
Milestone
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.10devel
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?linuxamd64
What did you do?
This code is an example of how
for i,x := range array
loops are rewritten whena loop preemption check is inserted, for two variants of the range check (unsigned
and signed -- unsigned should be easier, but because 0 <= i < len(l), signed i+1 is also
guaranteed to be greater than zero).
When compiled, it would be nice if the bounds checks for the array access were eliminated, but the rewritten loops does not match of the idioms that are checked for (it is more difficult, since the bounds check fact arrives on two predecessors, and one of those is a backedge).
What did you expect to see?
Bounds checks removed (well, I didn't really expect to see them...)
What did you see instead?
The text was updated successfully, but these errors were encountered: