You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[release-1.12] Workaround poor inlining behavior for if @generated functions (#58996)
Restores something very close to the previous inlining behavior, without
reverting #54972
This is a hack to workaround
#58915 (comment)
for 1.12, but we should leave an issue open so that we can put in a
proper fix to inlining for the next major version.
Also improves
#58915 (comment),
which was a dynamic `call` on 1.11 and a poorly-chosen `invoke` of the
generator fallback on 1.12. This is now an inlined version of the
non-fallback path for the generator:
```julia
julia> nt = (next = zero(UInt32), prev = zero(UInt32))
(next = 0x00000000, prev = 0x00000000)
julia> f(nt) = @inline Base.setindex(nt, 2, :next)
f (generic function with 1 method)
julia> @code_warntype optimize=true f(nt)
MethodInstance for f(::@NamedTuple{next::UInt32, prev::UInt32})
from f(nt) @ Main REPL[2]:1
Arguments
#self#::Core.Const(Main.f)
nt::@NamedTuple{next::UInt32, prev::UInt32}
Body::@NamedTuple{next::Int64, prev::UInt32}
1 ─ %1 = builtin Base.getfield(nt, :prev)::UInt32
│ %2 = %new(@NamedTuple{next::Int64, prev::UInt32}, 2, %1)::@NamedTuple{next::Int64, prev::UInt32}
└── return %2
```
0 commit comments