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

compact! does not clean-up unused ϕ nodes with ::Union{} type #53640

Open
topolarity opened this issue Mar 7, 2024 · 0 comments
Open

compact! does not clean-up unused ϕ nodes with ::Union{} type #53640

topolarity opened this issue Mar 7, 2024 · 0 comments

Comments

@topolarity
Copy link
Member

topolarity commented Mar 7, 2024

This accounts for the difference observed in #53512 (comment), since somewhere between 1.9 and 1.10 we stopped wrapping those buggy ϕ's in Core.Compiler.MaybeUndef().

MWE:

julia> include("test/compiler/irutils.jl")
make_ircode (generic function with 1 method)

julia> let code = Any[
                      # block 1
                      #= %1 =# Expr(:call, :opaque),
                      #= %2 =# Core.GotoIfNot(Core.SSAValue(1), 4),
                      # block 2
                      #= %3 =# nothing,
                      # block 3
                      #= %4 =# Core.PhiNode(Int32[2,3], Array{Any}(undef, 2)),
                      #= %5 =# Core.ReturnNode(nothing),
                  ]
                  ir = make_ircode(code)
                  ir.stmts.type[4] = Union{}
                  ir.stmts.flag[4] |= Core.Compiler.IR_FLAG_EFFECT_FREE | Core.Compiler.IR_FLAG_NOTHROW | Core.Compiler.IR_FLAG_CONSISTENT
                  Core.Compiler.compact!(ir)
              end
 1%1 = opaque()::Any                                                                                                                                                 │
 └──      goto #3 if not %1                                                                                                                                             │
 2nothing::Nothing3 ┄      φ (#1 => #undef, #2 => #undef)::Union{}                                                                                                                       │
 └──      return nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant