perf: allow boxed scalars passed to scalar params to be borrowed (#9360)

This commit is contained in:
Cameron Zwarich 2025-07-14 12:58:01 -07:00 committed by GitHub
parent cfb13b1689
commit c0079fd9dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -196,7 +196,7 @@ def ownArgsUsingParams (xs : Array Arg) (ps : Array Param) : M Unit :=
xs.size.forM fun i _ => do
let x := xs[i]
let p := ps[i]!
unless p.borrow do ownArg x
unless p.borrow || p.ty.isScalar do ownArg x
/-- For each xs[i], if xs[i] is owned, then mark ps[i] as owned.
We use this action to preserve tail calls. That is, if we have