Skip to content

Commit 02ea9c4

Browse files
committed
inlining: remove bonus for Tuple return with heap references
Added in #22210 (and earlier begun in #20853), this is no longer necessary to avoid heap allocations, and thus serves little purpose now.
1 parent 6d380be commit 02ea9c4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

base/compiler/optimize.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ function optimize(opt::OptimizationState, params::OptimizationParams, @nospecial
245245
# obey @inline declaration if a dispatch barrier would not help
246246
else
247247
bonus = 0
248-
if result Tuple && !isbitstype(widenconst(result))
248+
if result Tuple && !isconcretetype(widenconst(result))
249249
bonus = params.inline_tupleret_bonus
250250
end
251251
if opt.src.inlineable

base/compiler/types.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct OptimizationParams
4444
inlining::Bool # whether inlining is enabled
4545
inline_cost_threshold::Int # number of CPU cycles beyond which it's not worth inlining
4646
inline_nonleaf_penalty::Int # penalty for dynamic dispatch
47-
inline_tupleret_bonus::Int # extra willingness for non-isbits tuple return types
47+
inline_tupleret_bonus::Int # extra inlining willingness for non-concrete tuple return types (in hopes of splitting it up)
4848
inline_error_path_cost::Int # cost of (un-optimized) calls in blocks that throw
4949

5050
# Duplicating for now because optimizer inlining requires it.
@@ -57,7 +57,7 @@ struct OptimizationParams
5757
inlining::Bool = inlining_enabled(),
5858
inline_cost_threshold::Int = 100,
5959
inline_nonleaf_penalty::Int = 1000,
60-
inline_tupleret_bonus::Int = 400,
60+
inline_tupleret_bonus::Int = 250,
6161
inline_error_path_cost::Int = 20,
6262
max_methods::Int = 3,
6363
tuple_splat::Int = 32,

0 commit comments

Comments
 (0)