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

Method error during optimization #50276

Closed
maleadt opened this issue Jun 23, 2023 · 1 comment · Fixed by #50312
Closed

Method error during optimization #50276

maleadt opened this issue Jun 23, 2023 · 1 comment · Fixed by #50312
Assignees
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) kind:bug Indicates an unexpected problem or unintended behavior
Milestone

Comments

@maleadt
Copy link
Member

maleadt commented Jun 23, 2023

MWE:

df = (A = [missing], B = 1)
map(&, df.A , df.A , df.B > 1)
Internal error: encountered unexpected error in runtime:
MethodError(f=Base.string, args=(Expr(:&&, Expr(:call, :!==, :then_result, :SKIP_TOKEN), Expr(:call, :!==, :then_result, :UNDEF_TOKEN)),), world=0x00000000000015b0)
jl_method_error_bare at /source/src/gf.c:2204
jl_method_error at /source/src/gf.c:2222
jl_lookup_generic_ at /source/src/gf.c:3053 [inlined]
ijl_apply_generic at /source/src/gf.c:3068
macro expansion at ./error.jl:231 [inlined]
perform_lifting! at ./compiler/ssair/passes.jl:768
lift_comparison_leaves! at ./compiler/ssair/passes.jl:601
lift_comparison! at ./compiler/ssair/passes.jl:553 [inlined]
sroa_pass! at ./compiler/ssair/passes.jl:1011
run_passes at ./compiler/optimize.jl:489
run_passes at ./compiler/optimize.jl:504 [inlined]
optimize at ./compiler/optimize.jl:453 [inlined]
_typeinf at ./compiler/typeinfer.jl:272
typeinf at ./compiler/typeinfer.jl:216

As seen on PkgEval during testing of DataFramesMeta.jl.

Bisected to #49882, cc @topolarity.

@maleadt maleadt added kind:bug Indicates an unexpected problem or unintended behavior compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) labels Jun 23, 2023
@maleadt maleadt added this to the 1.10 milestone Jun 23, 2023
@topolarity
Copy link
Member

Uh oh, looks like this call-out was an issue after all.

Thanks for the report - will investigate

@topolarity topolarity self-assigned this Jun 23, 2023
topolarity added a commit to topolarity/julia that referenced this issue Jun 27, 2023
It's possible for PiNodes to effectively imply statically the condition
of a Core.ifelse. For example:
```julia
    23 ─ %60  = Core.ifelse(%47, false, true)::Bool
    │    %61  = Core.ifelse(%47, %58, false)::Union{Missing, Bool}
    25 ─        goto JuliaLang#27 if not %60
    26 ─ %65  = π (%61, Bool)
    └───        ...
```

In basic block JuliaLang#26, the PiNode gives us enough information to conclude
that `%47 === false` if control flow reaches that point. The previous
code incorrectly assumed that this kind of pruning would only be done
for PhiNodes.

Resolves JuliaLang#50276.
topolarity added a commit to topolarity/julia that referenced this issue Jun 27, 2023
It's possible for PiNodes to effectively imply statically the condition
of a Core.ifelse. For example:
```julia
    23 ─ %60  = Core.ifelse(%47, false, true)::Bool
    │    %61  = Core.ifelse(%47, %58, false)::Union{Missing, Bool}
    25 ─        goto JuliaLang#27 if not %60
    26 ─ %65  = π (%61, Bool)
    └───        ...
```

In basic block JuliaLang#26, the PiNode gives us enough information to conclude
that `%47 === false` if control flow reaches that point. The previous
code incorrectly assumed that this kind of pruning would only be done
for PhiNodes.

Resolves JuliaLang#50276.
topolarity added a commit to topolarity/julia that referenced this issue Jun 28, 2023
It's possible for PiNodes to effectively imply statically the condition
of a Core.ifelse. For example:
```julia
    23 ─ %60  = Core.ifelse(%47, false, true)::Bool
    │    %61  = Core.ifelse(%47, %58, false)::Union{Missing, Bool}
    25 ─        goto JuliaLang#27 if not %60
    26 ─ %65  = π (%61, Bool)
    └───        ...
```

In basic block JuliaLang#26, the PiNode gives us enough information to conclude
that `%47 === false` if control flow reaches that point. The previous
code incorrectly assumed that this kind of pruning would only be done
for PhiNodes.

Resolves JuliaLang#50276.
topolarity added a commit to topolarity/julia that referenced this issue Jun 28, 2023
It's possible for PiNodes to effectively imply statically the condition
of a Core.ifelse. For example:
```julia
    23 ─ %60  = Core.ifelse(%47, false, true)::Bool
    │    %61  = Core.ifelse(%47, %58, false)::Union{Missing, Bool}
    25 ─        goto JuliaLang#27 if not %60
    26 ─ %65  = π (%61, Bool)
    └───        ...
```

In basic block JuliaLang#26, the PiNode gives us enough information to conclude
that `%47 === false` if control flow reaches that point. The previous
code incorrectly assumed that this kind of pruning would only be done
for PhiNodes.

Resolves JuliaLang#50276.
topolarity added a commit to topolarity/julia that referenced this issue Jun 28, 2023
It's possible for PiNodes to effectively imply statically the condition
of a Core.ifelse. For example:
```julia
    23 ─ %60  = Core.ifelse(%47, false, true)::Bool
    │    %61  = Core.ifelse(%47, %58, false)::Union{Missing, Bool}
    25 ─        goto JuliaLang#27 if not %60
    26 ─ %65  = π (%61, Bool)
    └───        ...
```

In basic block JuliaLang#26, the PiNode gives us enough information to conclude
that `%47 === false` if control flow reaches that point. The previous
code incorrectly assumed that this kind of pruning would only be done
for PhiNodes.

Resolves JuliaLang#50276.
vtjnash pushed a commit that referenced this issue Jun 29, 2023
It's possible for PiNodes to effectively imply statically the condition
of a Core.ifelse. For example:
```julia
    23 ─ %60  = Core.ifelse(%47, false, true)::Bool
    │    %61  = Core.ifelse(%47, %58, false)::Union{Missing, Bool}
    25 ─        goto #27 if not %60
    26 ─ %65  = π (%61, Bool)
    └───        ...
```

In basic block #26, the PiNode gives us enough information to conclude
that `%47 === false` if control flow reaches that point. The previous
code incorrectly assumed that this kind of pruning would only be done
for PhiNodes.

Resolves #50276
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:optimizer Optimization passes (mostly in base/compiler/ssair/) kind:bug Indicates an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants