From aa41ba54177395a58514ba7ab0633b1c21ea9534 Mon Sep 17 00:00:00 2001 From: Keno Fischer Date: Tue, 9 Apr 2024 08:20:49 +0000 Subject: [PATCH] irinterp: Don't try to access mi.def if it's not a Method I don't believe this is reachable from the base compiler pipeline, since we don't run irinterp on toplevel things, but I am seeing this in downstream packages. --- base/compiler/inferencestate.jl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/base/compiler/inferencestate.jl b/base/compiler/inferencestate.jl index 73c697d81b184..48784378ef7c1 100644 --- a/base/compiler/inferencestate.jl +++ b/base/compiler/inferencestate.jl @@ -783,9 +783,13 @@ mutable struct IRInterpretationState for i = 1:length(given_argtypes) given_argtypes[i] = widenslotwrapper(argtypes[i]) end - given_argtypes = va_process_argtypes(optimizer_lattice(interp), given_argtypes, mi) - argtypes_refined = Bool[!⊑(optimizer_lattice(interp), ir.argtypes[i], given_argtypes[i]) - for i = 1:length(given_argtypes)] + if isa(mi.def, Method) + given_argtypes = va_process_argtypes(optimizer_lattice(interp), given_argtypes, mi) + argtypes_refined = Bool[!⊑(optimizer_lattice(interp), ir.argtypes[i], given_argtypes[i]) + for i = 1:length(given_argtypes)] + else + argtypes_refined = Bool[false for i = 1:length(given_argtypes)] + end empty!(ir.argtypes) append!(ir.argtypes, given_argtypes) tpdum = TwoPhaseDefUseMap(length(ir.stmts))