-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Currently this PR just re-uses ["effect-freeness" of a statement](https://github.com/JuliaLang/julia/blob/94b9d66b10e8e3ebdb268e4be5f7e1f43079ad4e/base/compiler/ssair/queries.jl#L6) computed by inliner. This is necessary but we lose much analysis accuracy, e.g. now we can't recognize the target below: ```julia julia> @noinline f_noescape(x) = (broadcast(identity, x); nothing); julia> analyze_escapes() do f_noescape(Ref("Hi")) end var"#3#4"() 1 → 1 ─ %1 = %new(Base.RefValue{String}, "Hi")::Base.RefValue{String} 2 ↑ │ %2 = invoke Main.f_noescape(%1::Base.RefValue{String})::Core.Const(nothing) 3 ◌ └── return %2 ``` This case is particularly because Julia compiler doesn't tell `getfield(::Base.RefValue, :x)` is "effect-free" since it's caught by [this `field <= datatype_min_ninitialized(s)` check](https://github.com/JuliaLang/julia/blob/94b9d66b10e8e3ebdb268e4be5f7e1f43079ad4e/base/compiler/tfuncs.jl#L745). We may need to improve inference instead rather than doing something in this pass.
- Loading branch information
Showing
2 changed files
with
86 additions
and
46 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