-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Remove array allocations that are trivially dead #43548
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
Conversation
|
Can you change the base branch from which you made changes specific for this PR (for easier review)? At a glance, it looks like you miss some cases when array allocations are "unsafe", e.g.: function foo()
a = Vector{Int}(undef, -10) # shouldn't be eliminated, otherwise it changes the error semantics
nothing
endGiven that this essentially needs some shape information, I guess we can implement this at Julia level relatively easier? |
|
Since my branches are part of a fork, I've created a PR comparing this one and the branch elimination PR immediately before it here: pchintalapudi#1 |
de250fa to
506c3a6
Compare
506c3a6 to
45ef4d5
Compare
45ef4d5 to
dfafcf3
Compare
Some arrays are only ever stored to, and can be safely removed without affecting program semantics. This PR removes such dead arrays by reusing AllocOpt infrastructure to remove dead objects. This also sets up future stack-based array optimizations by providing a method to delete newly dead arrays.
Depends on #43384 , #43547 , #43487 , and #43057 for array/escape analysis infrastructure improvements.