Skip to content

Commit

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

This implements the suggestion in
#27857 (comment)

(cherry picked from commit 8d6c1ce)
  • Loading branch information
JeffBezanson authored and KristofferC committed Feb 20, 2020
1 parent b1a39ae commit 4afbacb
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 4afbacb

Please sign in to comment.