Skip to content

Commit

Permalink
always obey inline declarations if the calling signature is concrete (J…
Browse files Browse the repository at this point in the history
…uliaLang#29258)

This implements the suggestion in
JuliaLang#27857 (comment)

(cherry picked from commit 8d6c1ce)
  • Loading branch information
JeffBezanson authored and KristofferC committed Sep 30, 2018
1 parent 69e8fc6 commit 2f9e279
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions base/compiler/optimize.jl
Original file line number Diff line number Diff line change
Expand Up @@ -234,15 +234,19 @@ function optimize(opt::OptimizationState, @nospecialize(result))
if force_noinline
opt.src.inlineable = false
elseif isa(def, Method)
bonus = 0
if result Tuple && !isbitstype(widenconst(result))
bonus = opt.params.inline_tupleret_bonus
end
if opt.src.inlineable
# For functions declared @inline, increase the cost threshold 20x
bonus += opt.params.inline_cost_threshold*19
if opt.src.inlineable && isdispatchtuple(opt.linfo.specTypes)
# obey @inline declaration if a dispatch barrier would not help
else
bonus = 0
if result Tuple && !isbitstype(widenconst(result))
bonus = opt.params.inline_tupleret_bonus
end
if opt.src.inlineable
# For functions declared @inline, increase the cost threshold 20x
bonus += opt.params.inline_cost_threshold*19
end
opt.src.inlineable = isinlineable(def, opt, bonus)
end
opt.src.inlineable = isinlineable(def, opt, bonus)
end
nothing
end
Expand Down

0 comments on commit 2f9e279

Please sign in to comment.