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

optimizer: alias-aware SROA #43888

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 5 additions & 1 deletion base/compiler/bootstrap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ let
world = get_world_counter()
interp = NativeInterpreter(world)

analyze_escapes_tt = Tuple{typeof(analyze_escapes), IRCode, Int, Bool, typeof(null_escape_cache)}
analyze_escapes_tt = Any[typeof(analyze_escapes), IRCode, Int, Bool,
# typeof(get_escape_cache(code_cache(interp))) # once we enable IPO EA
typeof(null_escape_cache)
]
analyze_escapes_tt = Tuple{analyze_escapes_tt...}
fs = Any[
# we first create caches for the optimizer, because they contain many loop constructions
# and they're better to not run in interpreter even during bootstrapping
Expand Down
17 changes: 16 additions & 1 deletion base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,10 +537,25 @@ function run_passes(ci::CodeInfo, sv::OptimizationState, caller::InferenceResult
@timeit "slot2reg" ir = slot2reg(ir, ci, sv)
# TODO: Domsorting can produce an updated domtree - no need to recompute here
@timeit "compact 1" ir = compact!(ir)
nargs = let def = sv.linfo.def; isa(def, Method) ? Int(def.nargs) : 0; end
# if is_ipo_profitable(ir, nargs)
# @timeit "IPO EA" begin
# state = analyze_escapes(ir,
# nargs, #=call_resolved=#false, ipo_escape_cache(sv.inlining.mi_cache))
# cache_escapes!(caller, state)
# end
# end
@timeit "Inlining" ir = ssa_inlining_pass!(ir, ir.linetable, sv.inlining, ci.propagate_inbounds)
# @timeit "verify 2" verify_ir(ir)
@timeit "compact 2" ir = compact!(ir)
@timeit "SROA" ir = sroa_pass!(ir)
@timeit "SROA" ir, memory_opt, get_domtree = linear_pass!(ir)
if memory_opt
@timeit "memory_opt_pass!" begin
@timeit "Local EA" estate = analyze_escapes(ir,
nargs, #=call_resolved=#true, null_escape_cache)
@timeit "memory_opt_pass!" ir = memory_opt_pass!(ir, estate, get_domtree)
end
end
@timeit "ADCE" ir = adce_pass!(ir)
@timeit "type lift" ir = type_lift_pass!(ir)
@timeit "compact 3" ir = compact!(ir)
Expand Down
Loading