cmd/compile: use CTNIL for pointer-typed OLITERALs
We used to be more aggressive about constant folding in the frontend, handling expressions that the Go spec does not consider constant; e.g., "(*int)(unsafe.Pointer(uintptr(200)))". However, that led to a lot of subtle Go spec conformance issues, so we've since abandoned that effort (CL 151320), leaving SSA to handle these cases instead. As such, the only time we now end up with pointer-typed OLITERALs is when "nil" is implicitly converted to a pointer-typed variable. Instead of representing these OLITERALs with an CTINT of 0, we can just use CTNIL. Saves a few bytes of memory and lines of code. Change-Id: Ibc5c756b992fdc89c3bdaf4fda3aa352e8e2b101 Reviewed-on: https://go-review.googlesource.com/c/go/+/193437 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
Showing
Please register or sign in to comment