Skip to content

Commit bf8f814

Browse files
authored
inference: don't add backdge when applicable inferred to return Bool (#56316)
Also just as a minor backedge reduction optimization, this commit avoids adding backedges when `applicable` is inferred to return `::Bool`.
1 parent b38fde1 commit bf8f814

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

base/compiler/tfuncs.jl

+10-8
Original file line numberDiff line numberDiff line change
@@ -3008,14 +3008,16 @@ function abstract_applicable(interp::AbstractInterpreter, argtypes::Vector{Any},
30083008
else
30093009
rt = Const(true) # has applicable matches
30103010
end
3011-
for i in 1:napplicable
3012-
match = applicable[i]::MethodMatch
3013-
edge = specialize_method(match)::MethodInstance
3014-
add_backedge!(sv, edge)
3015-
end
3016-
# also need an edge to the method table in case something gets
3017-
# added that did not intersect with any existing method
3018-
add_uncovered_edges!(sv, matches, atype)
3011+
if rt !== Bool
3012+
for i in 1:napplicable
3013+
match = applicable[i]::MethodMatch
3014+
edge = specialize_method(match)
3015+
add_backedge!(sv, edge)
3016+
end
3017+
# also need an edge to the method table in case something gets
3018+
# added that did not intersect with any existing method
3019+
add_uncovered_edges!(sv, matches, atype)
3020+
end
30193021
end
30203022
return Future(CallMeta(rt, Union{}, EFFECTS_TOTAL, NoCallInfo()))
30213023
end

0 commit comments

Comments
 (0)