-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/compile: avoid dead code in escape analysis #16871
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
Ordering the many compiler stages is a tricky problem. It'd also be nice for dead code not to count against a function's budget for inlining. It might be nice to add an early, crude deadcode pass, which implies also doing a bunch of constant folding. And we'd need to make sure all code gets typechecked, dead or not. |
Looks to be the same as #12397. |
Could we just do escape analysis at the very end? After at least inlining
and DCE.
|
Right now DCE is in SSA and SSA uses results of escape analysis, so that's moderately tricky. We would need an even-more-generic form of SSA that was (initially) agnostic about whether things were heap or stack allocated. |
On Feb 1, 2017 10:38 AM, "dr2chase" <notifications@github.com> wrote:
Right now DCE is in SSA and SSA uses results of escape analysis, so that's
moderately tricky. We would need an even-more-generic form of SSA that was
(initially) agnostic about whether things were heap or stack allocated.
But running escape analysis after inlining and DCE would be well worth the
effort.
|
On Wed, Feb 1, 2017 at 8:10 AM, Minux Ma ***@***.***> wrote:
On Feb 1, 2017 10:38 AM, "dr2chase" ***@***.***> wrote:
Right now DCE is in SSA and SSA uses results of escape analysis, so that's
moderately tricky. We would need an even-more-generic form of SSA that was
(initially) agnostic about whether things were heap or stack allocated.
But running escape analysis after inlining and DCE would be well worth the
effort.
Escape analysis does run after inlining.
I agree that running escape analysis after DCE would be nice. I suspect it
is a ton of work, though.
… —
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#16871 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AGkgIIf5XWrUSuror-bZdx6NI7z7FNMwks5rYK6JgaJpZM4Jso83>
.
|
CL https://golang.org/cl/37508 mentions this issue. |
Using
go1.7
Consider the following function:
Currently,
codes
escapes to the heap. I expect it to not escape since the function where it does escape sort.IntsAreSorted is dead. (the fact thatcodes
escapes at all in sort.IntsAreSorted is a separate concern)./cc @dr2chase
The text was updated successfully, but these errors were encountered: