-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: constant propagation into make() function #17275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I asked the OP to log this bug. I wondered if it were possible for the I don't think example 3.go is relevant to this discussion. On Thu, 29 Sep 2016, 18:10 Garfiled [email protected] wrote:
|
This is a "phase order problem", aka "stupid compiler trick". Constant propagation happens in SSA, which happens after escape analysis. Not clear if the better approach to this is to move escape analysis towards the SSA phase (note that one goal of escape analysis is to find those things that cannot be SSA-analyzed, so this is a fundamental change) or to do some simple constant propagation in the earlier phase of the compiler. |
This is essentially a dup of #20533 ( |
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go1.7
What operating system and processor architecture are you using (
go env
)?amd64
What did you do?
example1.go
s will be allocated in stack and lookup assemble code not call runtime.makeslice
example2.go
s will be allocated in heap and lookup assemble code there is runtime.makeslice why this ??
example3.go
lookup the assemble code and see the compiler is very clever to opt that but in example2.go why don't do this
The text was updated successfully, but these errors were encountered: