Skip to content

Commit 8d6c1ce

Browse files
authored
always obey inline declarations if the calling signature is concrete (#29258)
This implements the suggestion in #27857 (comment)
1 parent 48f5bb3 commit 8d6c1ce

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

base/compiler/optimize.jl

+12-8
Original file line numberDiff line numberDiff line change
@@ -234,15 +234,19 @@ function optimize(opt::OptimizationState, @nospecialize(result))
234234
if force_noinline
235235
opt.src.inlineable = false
236236
elseif isa(def, Method)
237-
bonus = 0
238-
if result Tuple && !isbitstype(widenconst(result))
239-
bonus = opt.params.inline_tupleret_bonus
240-
end
241-
if opt.src.inlineable
242-
# For functions declared @inline, increase the cost threshold 20x
243-
bonus += opt.params.inline_cost_threshold*19
237+
if opt.src.inlineable && isdispatchtuple(opt.linfo.specTypes)
238+
# obey @inline declaration if a dispatch barrier would not help
239+
else
240+
bonus = 0
241+
if result Tuple && !isbitstype(widenconst(result))
242+
bonus = opt.params.inline_tupleret_bonus
243+
end
244+
if opt.src.inlineable
245+
# For functions declared @inline, increase the cost threshold 20x
246+
bonus += opt.params.inline_cost_threshold*19
247+
end
248+
opt.src.inlineable = isinlineable(def, opt, bonus)
244249
end
245-
opt.src.inlineable = isinlineable(def, opt, bonus)
246250
end
247251
nothing
248252
end

0 commit comments

Comments
 (0)