forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
optimizer: enhance SROA, form
PhiNode
for uninitialized field (Juli…
…aLang#43208) This commit addresses this [TODO comment](https://github.com/JuliaLang/julia/blob/3a5146f6b94e32bef5a812619068f82218b5482c/base/compiler/ssair/passes.jl#L831-L832), and allows SROA pass to form `PhiNode`s for uninitialized fields when we can prove there are safe `setfield!` calls in all dominated control flows. Now SROA can eliminate this sort of allocation: ```julia let src = code_typed((Bool,)) do cond r = Ref{Any}() if cond r[] = 42 else r[] = 32 end return r[] end |> only |> first @test !any(isnew, src.code) end ```
- Loading branch information
1 parent
5038efa
commit 7247ee3
Showing
2 changed files
with
64 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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