We don't really need a nil pointer check, as the index is bounded by the bounds check.
We can subsume the nil pointer check into the load.
This would require the nil pointer pass to know that indexes are bounded for indexed loads, so it can prove that the load still occurs in the zero page even with the largest possible index.
Maybe we need to keep some information from the prove pass around somehow?
The text was updated successfully, but these errors were encountered:
If p is nil and i is out of bound, this may change the error produced from a nil pointer panic to a bound error. Not sure if this matters. If this does matter, we could do the nil check only on the out-of-bound code path, before issuing an out-of-bound panic.