Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/Lean/Compiler/LCNF/LambdaLifting.lean
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,17 @@ def lambdaLifting : Pass where
decls.foldlM (init := #[]) fun decls decl => return decls ++ (← decl.lambdaLifting false (suffix := `_lam))

/--
During eager lambda lifting, we lift
- All local function declarations from instances (motivation: make sure it is cheap to inline them later)
- Local function declarations that take local instances as parameters (motivation: ensure they are specialized)
During eager lambda lifting, we inspect declarations that are not inlineable or instances (doing it
everywhere can accidentally introduce mutual recursion which the compiler cannot handle well at the
moment). We then lift local function declarations that take local instances as parameters from
their body to ensure they are specialized.
-/
def eagerLambdaLifting : Pass where
phase := .base
name := `eagerLambdaLifting
run := fun decls => do
decls.foldlM (init := #[]) fun decls decl => do
if decl.inlineAttr || (← Meta.isInstance decl.name) then
if decl.inlineable || (← Meta.isInstance decl.name) then
return decls.push decl
else
return decls ++ (← decl.lambdaLifting (liftInstParamOnly := true) (suffix := `_elam))
Expand Down
Loading