Remove array allocations that are trivially dead#43548
Closed
pchintalapudi wants to merge 33 commits intoJuliaLang:masterfrom
Closed
Remove array allocations that are trivially dead#43548pchintalapudi wants to merge 33 commits intoJuliaLang:masterfrom
pchintalapudi wants to merge 33 commits intoJuliaLang:masterfrom
Conversation
Member
|
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? |
Member
Author
|
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
Member
Author
added 14 commits
January 13, 2022 20:20
added 7 commits
January 13, 2022 20:23
506c3a6 to
45ef4d5
Compare
45ef4d5 to
dfafcf3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.