Hi!

Iβm aware of #15276 but today I encountered an issue in the proposed workaround.

```
using FFTW
function f(x)
p = plan_fft(x)
x_ft = p * x
# given workaround in performance tips
g = let p = p
x_ft = x_ft
a -> (p*a) * x_ft
end
return g
end
function f2(x)
p = plan_fft(x)
x_ft = p * x
# difference is a local name which is different to the original x_ft
g = let p = p
x_ft2 = x_ft
a -> (p*a) * x_ft2
end
return g
end
```

The first function struggles with boxing, the second not:

```
julia> g = f(x)
#9 (generic function with 1 method)
julia> @code_warntype g(x)
MethodInstance for (::var"#9#10"{FFTW.cFFTWPlan{ComplexF64, -1, false, 2, UnitRange{Int64}}})(::Matrix{Float64})
from (::var"#9#10")(a) in Main at /home/fxw/.julia/dev/FourierTools.jl/lel.jl:11
Arguments
#self#::var"#9#10"{FFTW.cFFTWPlan{ComplexF64, -1, false, 2, UnitRange{Int64}}}
a::Matrix{Float64}
Locals
x_ft::Union{}
Body::Any
1 β %1 = Core.getfield(#self#, Symbol("#66#p"))::FFTW.cFFTWPlan{ComplexF64, -1, false, 2, UnitRange{Int64}}
β %2 = (%1 * a)::Matrix{ComplexF64}
β %3 = Core.getfield(#self#, :x_ft)::Core.Box
β %4 = Core.isdefined(%3, :contents)::Bool
βββ goto #3 if not %4
2 β goto #4
3 β Core.NewvarNode(:(x_ft))
βββ x_ft
4 β %9 = Core.getfield(%3, :contents)::Any
β %10 = (%2 * %9)::Any
βββ return %10
julia> g2 = f2(x)
#15 (generic function with 1 method)
julia> @code_warntype g2(x)
MethodInstance for (::var"#15#16"{Matrix{ComplexF64}, FFTW.cFFTWPlan{ComplexF64, -1, false, 2, UnitRange{Int64}}})(::Matrix{Float64})
from (::var"#15#16")(a) in Main at /home/fxw/.julia/dev/FourierTools.jl/lel.jl:25
Arguments
#self#::var"#15#16"{Matrix{ComplexF64}, FFTW.cFFTWPlan{ComplexF64, -1, false, 2, UnitRange{Int64}}}
a::Matrix{Float64}
Body::Matrix{ComplexF64}
1 β %1 = Core.getfield(#self#, Symbol("#76#p"))::FFTW.cFFTWPlan{ComplexF64, -1, false, 2, UnitRange{Int64}}
β %2 = (%1 * a)::Matrix{ComplexF64}
β %3 = Core.getfield(#self#, :x_ft2)::Matrix{ComplexF64}
β %4 = (%2 * %3)::Matrix{ComplexF64}
βββ return %4
```

What is the reason for this behavior? It is definitely related to the FFTW planning or at least to the `FFTW.cFFTWPlan`

(which is an own type).

Best,

Felix