Skip to content

Eliding boundschecks does not work with vararg function #46351

Open

Description

Discovered by matthias314 in this discourse thread

julia> @inline function f(x...)
           @boundscheck println("checking bounds")
           return 0
       end
f (generic function with 1 method)

julia> g(x...) = @inbounds f(x...)
g (generic function with 1 method)

julia> g(1, 1)
checking bounds
0

Annoyingly, code introspection gives incorrect results, presumably due to #32834. Maybe the issue is that it doesn't actually inline?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    compiler:optimizerOptimization passes (mostly in base/compiler/ssair/)performanceMust go faster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions