cmd/compile: duplicated panicslice calls in a single function #30437
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?1.10/1.11 (on godbolt.org)
Does this issue reproduce with the latest release?
Not sure, godbolt doesn't have 1.12 yet.
What operating system and processor architecture are you using (
go env
)?x86
What did you do?
Messed with some benchmarks, looked to see whether they were generating bounds checks.
What did you expect to see?
Less bounds checking.
What did you see instead?
This isn't actually about the amount of bounds checking generated. It's about the fact that identical blocks of code were generated several times consecutively.
https://godbolt.org/z/IfZOAD
Look in particular around lines 172-180 or so of the go1.11 output, or 134-150 of the go1.10 output. There's multiple instances of identical panic calls with distinct labels:
I wouldn't expect the compiler to realize that it could insert a label halfway through the _pc198 code, but I would expect it to be able to recognize that 205, 212, and 219 are all the same code.
(I was also hoping the bounds checker wouldn't need to generate those at all, but we can't have everything.)
The text was updated successfully, but these errors were encountered: