cmd/compile: elide call to runtime.growslice with provable capacity availability #30509
Labels
binary-size
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
Using
go1.12
Consider the following snippet:
This compiles to the following snippet:
The regions marked in red seem superfluous. At a high-level, we already know that
cap(b)-len(b) > 3
so the check at 0x0037 is entire redundant. Also since there is guaranteed capacity, the code at 0x0069 and on is entirely unnecessary.The text was updated successfully, but these errors were encountered: