diff --git a/bin/generate_builtins.jl b/bin/generate_builtins.jl index d76ea7b6..323a6eec 100644 --- a/bin/generate_builtins.jl +++ b/bin/generate_builtins.jl @@ -132,16 +132,6 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool) f = @lookup(frame, fex) end - if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure - if expand - if !Core.Compiler.uncompressed_ir(f.source).inferred - return Expr(:call, f, args[2:end]...) - else - @debug "not interpreting opaque closure \$f since it contains inferred code" - end - end - return Some{Any}(f(args...)) - end if !(isa(f, Core.Builtin) || isa(f, Core.IntrinsicFunction)) return call_expr end diff --git a/src/builtins.jl b/src/builtins.jl index 2906af86..b57a6192 100644 --- a/src/builtins.jl +++ b/src/builtins.jl @@ -38,16 +38,6 @@ function maybe_evaluate_builtin(frame, call_expr, expand::Bool) f = @lookup(frame, fex) end - if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure - if expand - if !Core.Compiler.uncompressed_ir(f.source).inferred - return Expr(:call, f, args[2:end]...) - else - @debug "not interpreting opaque closure $f since it contains inferred code" - end - end - return Some{Any}(f(args...)) - end if !(isa(f, Core.Builtin) || isa(f, Core.IntrinsicFunction)) return call_expr end diff --git a/src/construct.jl b/src/construct.jl index 64e54971..79a37f4f 100644 --- a/src/construct.jl +++ b/src/construct.jl @@ -244,7 +244,10 @@ function prepare_call(@nospecialize(f), allargs; enter_generated = false) if @static isdefined(Core, :OpaqueClosure) && f isa Core.OpaqueClosure method = f.source # don't try to interpret optimized ir - if Core.Compiler.uncompressed_ir(method).inferred + is_inferred_ir = any(Core.Compiler.uncompressed_ir(f.source).code) do stmt + stmt isa Core.PiNode || stmt isa Core.PhiNode || stmt isa Core.PhiCNode || stmt isa Core.UpsilonNode + end + if is_inferred_ir @debug "not interpreting opaque closure $f since it contains inferred code" return nothing end