Skip to content

Commit f8d2294

Browse files
committed
Fix inference heuristic hacks
These were broken by #11274 but no one noticed. Fixes #13350.
1 parent ef59efe commit f8d2294

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

base/inference.jl

+5-3
Original file line numberDiff line numberDiff line change
@@ -2375,11 +2375,13 @@ function inlineable(f::ANY, e::Expr, atype::ANY, sv::StaticVarInfo, enclosing_as
23752375
if incompletematch
23762376
cost *= 4
23772377
end
2378-
if is(f, next) || is(f, done) || is(f, unsafe_convert) || is(f, cconvert)
2378+
if isgf && (istopfunction(topmod, f, :next) || istopfunction(topmod, f, :done) ||
2379+
istopfunction(topmod, f, :unsafe_convert) || istopfunction(topmod, f, :cconvert))
23792380
cost ÷= 4
23802381
end
2381-
inline_op = isgeneric(f) && (f===(+) || f===(*) || f===min || f===max) && (3 <= length(argexprs) <= 9) &&
2382-
methsig == Tuple{Any,Any,Any,Vararg{Any}}
2382+
inline_op = isgf && (istopfunction(topmod, f, :+) || istopfunction(topmod, f, :*) ||
2383+
istopfunction(topmod, f, :min) || istopfunction(topmod, f, :max)) &&
2384+
(3 <= length(argexprs) <= 9) && methsig == Tuple{Any,Any,Any,Vararg{Any}}
23832385
if !inline_op && !inline_worthy(body, cost)
23842386
if incompletematch
23852387
# inline a typeassert-based call-site, rather than a

0 commit comments

Comments
 (0)