Skip to content

Commit

Permalink
Split Core.Compiler.optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Nov 3, 2020
1 parent ce1cf9f commit 8b44973
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,11 @@ function stmt_affects_purity(@nospecialize(stmt), ir)
return true
end

# run the optimization work
function optimize(opt::OptimizationState, params::OptimizationParams, @nospecialize(result))
# Convert IRCode back to CodeInfo and compute inlining cost and sideeffects
function finish(opt::OptimizationState, params::OptimizationParams, ir, @nospecialize(result))
def = opt.linfo.def
nargs = Int(opt.nargs) - 1
@timeit "optimizer" ir = run_passes(opt.src, nargs, opt)

force_noinline = _any(@nospecialize(x) -> isexpr(x, :meta) && x.args[1] === :noinline, ir.meta)

# compute inlining and other related optimizations
Expand Down Expand Up @@ -271,6 +271,13 @@ function optimize(opt::OptimizationState, params::OptimizationParams, @nospecial
nothing
end

# run the optimization work
function optimize(opt::OptimizationState, params::OptimizationParams, @nospecialize(result))
nargs = Int(opt.nargs) - 1
@timeit "optimizer" ir = run_passes(opt.src, nargs, opt)
finish(opt, params, ir, result)
end


# whether `f` is pure for inference
function is_pure_intrinsic_infer(f::IntrinsicFunction)
Expand Down

0 comments on commit 8b44973

Please sign in to comment.