diff --git a/src/Lean/Compiler/Simp.lean b/src/Lean/Compiler/Simp.lean index 435fb2a98e..bb60bc9080 100644 --- a/src/Lean/Compiler/Simp.lean +++ b/src/Lean/Compiler/Simp.lean @@ -186,6 +186,7 @@ partial def visitCases (casesInfo : CasesInfo) (e : Expr) : SimpM Expr := do partial def inlineApp (e : Expr) (jp? : Option Expr := none) : SimpM Expr := do let f := e.getAppFn + trace[Compiler.simp.inline] "inlining {e}" let value ← match f with | .const declName us => let some decl ← getStage1Decl? declName | unreachable! @@ -245,6 +246,7 @@ partial def inlineApp? (e : Expr) (xs : Array Expr) (k? : Option Expr) : SimpM ( visitLet x (xs.push x) let body ← mkLetUsingScope body mkLambda #[y] body + let jp ← mkJpDeclIfNotSimple jp /- Inline `toInline` and "go-to" `jp` with the result. -/ inlineApp toInline jp @@ -298,6 +300,8 @@ partial def Decl.simp (decl : Decl) : CoreM Decl := do return decl builtin_initialize + registerTraceClass `Compiler.simp.inline + registerTraceClass `Compiler.simp.step registerTraceClass `Compiler.simp.inline.stats end Lean.Compiler \ No newline at end of file diff --git a/src/Lean/Compiler/TerminalCases.lean b/src/Lean/Compiler/TerminalCases.lean index acb9c9ab14..539067e697 100644 --- a/src/Lean/Compiler/TerminalCases.lean +++ b/src/Lean/Compiler/TerminalCases.lean @@ -36,8 +36,9 @@ private partial def visitLet (e : Expr) (fvars : Array Expr) : CompilerM Expr := let body ← visitLet body (fvars.push x) let body ← mkLetUsingScope body mkLambda #[x] body - value ← attachJp value jp - visitCases casesInfo value + let jp ← mkJpDeclIfNotSimple jp + value ← visitCases casesInfo value + attachJp value jp else if value.isLambda then value ← visitLambda value