Skip to content
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

inference: relax backedge optimization condition #45030

Merged
merged 1 commit into from
Apr 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions base/compiler/abstractinterpretation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,18 @@ function add_call_backedges!(interp::AbstractInterpreter,
@nospecialize(rettype), all_effects::Effects,
edges::Vector{MethodInstance}, matches::Union{MethodMatches,UnionSplitMethodMatches}, @nospecialize(atype),
sv::InferenceState)
if rettype === Any && all_effects === Effects()
# for `NativeInterpreter`, we don't need to add backedges when:
# - a new method couldn't refine (widen) this type and
# - the effects don't provide any useful information for interprocedural optimization
return
# we don't need to add backedges when:
# - a new method couldn't refine (widen) this type and
# - the effects are known to not provide any useful IPO information
if rettype === Any
if !isoverlayed(method_table(interp))
# we can ignore the `nonoverlayed` property if `interp` doesn't use
# overlayed method table at all since it will never be tainted anyway
all_effects = Effects(all_effects; nonoverlayed=false)
end
if all_effects === Effects()
return
end
end
for edge in edges
add_backedge!(edge, sv)
Expand Down