From fe224ab2fae3ba5df3271bc925aed2c4d380e7c3 Mon Sep 17 00:00:00 2001 From: Simeon David Schaub Date: Sat, 21 Sep 2024 18:08:12 +0200 Subject: [PATCH] remove special-casing in inlining --- base/boot.jl | 2 +- base/compiler/ssair/inlining.jl | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/base/boot.jl b/base/boot.jl index 94ccf45c2f60a..8899755dac825 100644 --- a/base/boot.jl +++ b/base/boot.jl @@ -326,7 +326,7 @@ cconvert(::Type{T}, x) where {T} = convert(T, x) unsafe_convert(::Type{T}, x::T) where {T} = x # will be inserted by the frontend for closures -_typeof_captured_variable(@nospecialize t) = has_free_typevars(t) ? typeof(t) : Typeof(t) +_typeof_captured_variable(@nospecialize t) = (@_total_meta; has_free_typevars(t) ? typeof(t) : Typeof(t)) has_free_typevars(@nospecialize t) = (@_total_meta; ccall(:jl_has_free_typevars, Int32, (Any,), t) === Int32(1)) diff --git a/base/compiler/ssair/inlining.jl b/base/compiler/ssair/inlining.jl index 358ab244fc51a..727e015b67062 100644 --- a/base/compiler/ssair/inlining.jl +++ b/base/compiler/ssair/inlining.jl @@ -1763,18 +1763,11 @@ function late_inline_special_case!(ir::IRCode, idx::Int, stmt::Expr, flag::UInt3 unionall_call = Expr(:foreigncall, QuoteNode(:jl_type_unionall), Any, svec(Any, Any), 0, QuoteNode(:ccall), stmt.args[2], stmt.args[3]) return SomeCase(unionall_call) - elseif f === _typeof_captured_variable - if isa(type, Const) - return SomeCase(quoted(type.val)) - elseif isconstType(type) - return SomeCase(quoted(type.parameters[1])) - end - # TODO we may still want to inline the body of `_typeof_captured_variable` here elseif is_return_type(f) - if isa(type, Const) - return SomeCase(quoted(type.val)) - elseif isconstType(type) + if isconstType(type) return SomeCase(quoted(type.parameters[1])) + elseif isa(type, Const) + return SomeCase(quoted(type.val)) end end return nothing