Skip to content

Commit d66010a

Browse files
committed
try to be more like GHC
1 parent 275f907 commit d66010a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/Lean/Compiler/LCNF/Passes.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def builtinPassManager : PassManager := {
9494
-- checked without nested functions whose bodies specialization does not require access to.
9595
checkTemplateVisibility,
9696
specialize,
97-
findJoinPoints (occurrence := 1),
97+
--findJoinPoints (occurrence := 1),
9898
simp (occurrence := 2),
9999
cse (shouldElimFunDecls := false) (occurrence := 1),
100100
saveBase, -- End of base phase

src/Lean/Compiler/LCNF/Simp.lean

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,20 @@ public import Lean.Compiler.LCNF.Simp.InlineProj
1818
public import Lean.Compiler.LCNF.Simp.DefaultAlt
1919
public import Lean.Compiler.LCNF.Simp.SimpValue
2020
public import Lean.Compiler.LCNF.Simp.Used
21+
import Lean.Compiler.LCNF.JoinPoints
2122

2223
public section
2324

2425
namespace Lean.Compiler.LCNF
2526
open Simp
2627

28+
private def findJoinPointsInCode (decl : Decl) (code : Code) : SimpM Code := do
29+
match ← Decl.findJoinPoints? { decl with value := .code code } with
30+
| some { value := .code code, ..} =>
31+
markSimplified
32+
return code
33+
| _ => return code
34+
2735
def Decl.simp? (decl : Decl) : SimpM (Option Decl) := do
2836
let .code code := decl.value | return none
2937
updateFunDeclInfo code
@@ -34,6 +42,7 @@ def Decl.simp? (decl : Decl) : SimpM (Option Decl) := do
3442
let code ← code.applyRenaming s.binderRenaming
3543
traceM `Compiler.simp.step.new do return m!"{decl.name} :=\n{← ppCode code}"
3644
trace[Compiler.simp.stat] "{decl.name}, size: {code.size}, # visited: {s.visited}, # inline: {s.inline}, # inline local: {s.inlineLocal}"
45+
let code ← findJoinPointsInCode decl code
3746
if let some code ← simpJpCases? code then
3847
let decl := { decl with value := .code code }
3948
decl.reduceJpArity

0 commit comments

Comments
 (0)