File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,12 @@ private partial def visitFnBody (b : FnBody) : M Unit := do
7070 match e with
7171 | .proj _ parent =>
7272 addDerivedValue parent x
73+ | .fap ``Array.getInternal args =>
74+ if let .var parent := args[1 ]! then
75+ addDerivedValue parent x
76+ | .fap ``Array.get!Internal args =>
77+ if let .var parent := args[2 ]! then
78+ addDerivedValue parent x
7379 | .reset _ x =>
7480 removeFromParent x
7581 | _ => pure ()
@@ -351,7 +357,13 @@ private def processVDecl (ctx : Context) (z : VarId) (t : IRType) (v : Expr) (b
351357 | .fap f ys =>
352358 let ps := (getDecl ctx f).params
353359 let b := addDecAfterFullApp ctx ys ps b bLiveVars
354- let b := .vdecl z t v b
360+ let v :=
361+ if f == ``Array.getInternal && bLiveVars.borrows.contains z then
362+ .fap ``Array.getInternalBorrowed ys
363+ else if f == ``Array.get!Internal && bLiveVars.borrows.contains z then
364+ .fap ``Array.get!InternalBorrowed ys
365+ else v
366+ let b := .vdecl z t v b
355367 addIncBefore ctx ys ps b bLiveVars
356368 | .ap x ys =>
357369 let ysx := ys.push (.var x) -- TODO: avoid temporary array allocation
You can’t perform that action at this time.
0 commit comments