Skip to content

Commit 7dfcf70

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

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
@@ -2250,11 +2250,13 @@ function inlineable(f::ANY, e::Expr, atype::ANY, sv::StaticVarInfo, enclosing_as
22502250
if incompletematch
22512251
cost *= 4
22522252
end
2253-
if is(f, next) || is(f, done) || is(f, unsafe_convert) || is(f, cconvert)
2253+
if istopfunction(topmod, f, :next) || istopfunction(topmod, f, :done) ||
2254+
istopfunction(topmod, f, :unsafe_convert) || istopfunction(topmod, f, :cconvert)
22542255
cost ÷= 4
22552256
end
2256-
inline_op = (f===(+) || f===(*) || f===min || f===max) && (3 <= length(argexprs) <= 9) &&
2257-
meth[3].sig == Tuple{Any,Any,Any,Vararg{Any}}
2257+
inline_op = (istopfunction(topmod, f, :+) || istopfunction(topmod, f, :*) ||
2258+
istopfunction(topmod, f, :min) || istopfunction(topmod, f, :max)) &&
2259+
(3 <= length(argexprs) <= 9) && meth[3].sig == Tuple{Any,Any,Any,Vararg{Any}}
22582260
if !inline_op && !inline_worthy(body, cost)
22592261
if incompletematch
22602262
# inline a typeassert-based call-site, rather than a

0 commit comments

Comments
 (0)