Skip to content

Commit 286ece2

Browse files
authored
inference: infer_compilation_signatures for even more cases (#56552)
Refs #56495
1 parent aa05c98 commit 286ece2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Compiler/src/abstractinterpretation.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -207,14 +207,14 @@ function abstract_call_gf_by_type(interp::AbstractInterpreter, @nospecialize(f),
207207
rettype = from_interprocedural!(interp, rettype, sv, arginfo, conditionals)
208208

209209
# Also considering inferring the compilation signature for this method, so
210-
# it is available to the compiler in case it ends up needing it for the invoke.
210+
# it is available to the compiler, unless it should not end up needing it (for an invoke).
211211
if (isa(sv, InferenceState) && infer_compilation_signature(interp) &&
212-
(seenall && 1 == napplicable) && !is_removable_if_unused(all_effects))
212+
(seenall && 1 == napplicable) && (!is_removable_if_unused(all_effects) || !call_result_unused(si)))
213213
(; match) = applicable[1]
214214
method = match.method
215215
sig = match.spec_types
216216
mi = specialize_method(match; preexisting=true)
217-
if mi !== nothing && !const_prop_methodinstance_heuristic(interp, mi, arginfo, sv)
217+
if mi === nothing || !const_prop_methodinstance_heuristic(interp, mi, arginfo, sv)
218218
csig = get_compileable_sig(method, sig, match.sparams)
219219
if csig !== nothing && csig !== sig
220220
abstract_call_method(interp, method, csig, match.sparams, multiple_matches, StmtInfo(false), sv)::Future

0 commit comments

Comments
 (0)