Skip to content

Consider inlining fldmod to allow optimizing if an arg is a Const #30333

@NHDaly

Description

@NHDaly

Opening an issue based on this discussion: JuliaMath/FixedPointDecimals.jl#43 (review)

In our code, fldmod isn't inlining. Where we are calling it, one of the arguments is a static compiler Const, and so the division could be optimized away (into a cheaper multiplication and bitshift -- explanation here: JuliaMath/FixedPointDecimals.jl#43 (comment)), but it isn't able to because the non-inlined fldmod presents a function barrier that prevents the compiler from knowing one of the arguments is a Const.

fldmod is such a simple function, so i'm surprised it wasn't inlining anyway. Would it make sense to mark this as @inline in Base? If you think so, i can send a PR to do it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions