Skip to content

Commit

Permalink
fix: recursive call also on delete and re-enable reuse specialization
Browse files Browse the repository at this point in the history
  • Loading branch information
anfelor committed Apr 1, 2024
1 parent d2ef785 commit 7c53777
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Lean/Compiler/IR/ExpandResetReuse.lean
Original file line number Diff line number Diff line change
Expand Up @@ -187,12 +187,14 @@ partial def searchAndSpecialize : FnBody → Array FnBody → Array VarId → Ha
let b ← searchAndSpecialize b #[] (tokens.push x) (subst.insert x y)
let b ← specializeReset x y mask b
return reshape bs b
-- | FnBody.vdecl z t (Expr.reuse w c u zs) b, bs, tokens, subst => do
-- let b ← searchAndSpecialize b #[] tokens subst
-- let b ← specializeReuse z w (subst.find! w) c u t zs b
-- return reshape bs b
| FnBody.vdecl z t (Expr.reuse w c u zs) b, bs, tokens, subst => do
let b ← searchAndSpecialize b #[] tokens subst
let b ← specializeReuse z w (subst.find! w) c u t zs b
return reshape bs b
| FnBody.dec z n c p b, bs, tokens, subst =>
if tokens.contains z then return FnBody.del z b
if tokens.contains z then do
let b ← searchAndSpecialize b #[] tokens subst
return reshape bs (FnBody.del z b)
else do
let b ← searchAndSpecialize b #[] tokens subst
return reshape bs (FnBody.dec z n c p b)
Expand Down

0 comments on commit 7c53777

Please sign in to comment.