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

inference: don't consider Const(::Type)-argument as const-profitable #51693

Closed
wants to merge 1 commit into from

Commits on Oct 17, 2023

  1. inference: don't consider Const(::Type)-argument as const-profitable

    I've observed that we're performing essentially-duplicated inference
    when type-argument(s) are represented as `Const`. For instance, in the
    code:
    ```julia
    descend((Int,)) do x
        Ref(x)
    end
    ```
    
    We first perform non-constant inference for `(::Type{Base.RefValue})(::Int)`
    and then constant inference for `(::Const(Base.RefValue))(::Int)`,
    although the latter "constant" inference is just wasteful. This happens
    because `Type{Base.RefValue}` propagates the essentially same
    information as `Const(Base.RefValue)`.
    
    To eliminate the wasteful constant propagation, this commit adjusts
    `is_const_prop_profitable_arg` such that it no longer considers
    `Const(x::Type)` as being beneficial for constant propagation.
    aviatesk committed Oct 17, 2023
    Configuration menu
    Copy the full SHA
    8b6ca36 View commit details
    Browse the repository at this point in the history