Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invoke-style backedge where there shouldn't be one #53020

Closed
timholy opened this issue Jan 23, 2024 · 1 comment · Fixed by #53121
Closed

invoke-style backedge where there shouldn't be one #53020

timholy opened this issue Jan 23, 2024 · 1 comment · Fixed by #53121
Labels
compiler:inference Type inference kind:bug Indicates an unexpected problem or unintended behavior regression 1.10 Regression in the 1.10 release

Comments

@timholy
Copy link
Sponsor Member

timholy commented Jan 23, 2024

julia> begin
       f(x::Int)  = 1
       f(x::Bool) = 2
       applyf(container::AbstractVector) = f(container[1])
       callapplyf(container) = applyf(container)
       end
callapplyf (generic function with 1 method)

julia> callapplyf(Any[1])
1

julia> mi = only(Base.specializations(only(methods(applyf))))
MethodInstance for applyf(::Vector{Any})

julia> mi.backedges
3-element Vector{Any}:
 MethodInstance for callapplyf(::Vector{Any})
 Tuple{typeof(applyf), AbstractVector}
 MethodInstance for callapplyf(::Vector{Any})

That last pair,

 Tuple{typeof(applyf), AbstractVector}
 MethodInstance for callapplyf(::Vector{Any})

is the kind of backedge you'd get if callapplyf were implemented as

callapplyf(container) = invoke(applyf, Tuple{AbstractVector}, container)

The fact that it's here seems to be a bug.

@timholy timholy added kind:bug Indicates an unexpected problem or unintended behavior compiler:inference Type inference regression 1.10 Regression in the 1.10 release labels Jan 23, 2024
@timholy
Copy link
Sponsor Member Author

timholy commented Jan 24, 2024

git-bisect identifies 6097140

vtjnash added a commit that referenced this issue Jan 30, 2024
This was inefficient, though not wrong.

Fixes #53020
aviatesk pushed a commit that referenced this issue Jan 31, 2024
aviatesk pushed a commit that referenced this issue Jan 31, 2024
KristofferC pushed a commit that referenced this issue Feb 5, 2024
Drvi pushed a commit to RelationalAI/julia that referenced this issue Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:inference Type inference kind:bug Indicates an unexpected problem or unintended behavior regression 1.10 Regression in the 1.10 release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant