cmd/compile: elide call to runtime.growslice with provable capacity availability #30509
Comments
CC @randall77 @josharian @martisch for proving things. |
Note sure how common the check ( For prove and any elimination of dead code the more general optimisation seems to be to infer from |
Yeah, the owners list for the compiler is unfortunate, in that there isn’t always a nice source path correspondence. For prove, I also think of @aclements, @rasky, and @zdjones. |
I ran a bisection and found that there is in fact a regression there caused by 38e7177. |
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: