perf: erase all constructor params in the mono phase (#9764)
This commit is contained in:
parent
ea09ffc8ce
commit
f759d5dbc1
4 changed files with 6 additions and 10 deletions
|
|
@ -73,11 +73,7 @@ def argsToMonoWithFnType (resultFVar : FVarId) (args : Array Arg) (type : Expr)
|
|||
|
||||
def ctorAppToMono (resultFVar : FVarId) (ctorInfo : ConstructorVal) (args : Array Arg)
|
||||
: ToMonoM LetValue := do
|
||||
let argsNewParams : Array Arg ← args[*...ctorInfo.numParams].toArray.mapM fun arg => do
|
||||
-- We only preserve constructor parameters that are types
|
||||
match arg with
|
||||
| .type type => return .type (← toMonoType type)
|
||||
| .fvar .. | .erased => return .erased
|
||||
let argsNewParams : Array Arg := .replicate ctorInfo.numParams .erased
|
||||
let argsNewFields ← args[ctorInfo.numParams...*].toArray.mapM (argToMonoDeferredCheck resultFVar)
|
||||
let argsNew := argsNewParams ++ argsNewFields
|
||||
return .const ctorInfo.name [] argsNew
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ trace: [Compiler.result] size: 5
|
|||
let _x.10 := Lean.Compiler.compile _x.1 _y.7 _y.8 _y.9;
|
||||
cases _x.10 : EStateM.Result Lean.Exception PUnit PUnit
|
||||
| EStateM.Result.ok a.11 a.12 =>
|
||||
let _x.13 := EStateM.Result.ok _ _ _ _x.2 a.12;
|
||||
let _x.13 := EStateM.Result.ok ◾ ◾ ◾ _x.2 a.12;
|
||||
return _x.13
|
||||
| EStateM.Result.error a.14 a.15 =>
|
||||
return _x.10
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ set_option trace.Compiler.result true
|
|||
/--
|
||||
trace: [Compiler.result] size: 1
|
||||
def Erased.mk (α : lcErased) (a : lcAny) : PSigma lcErased lcAny :=
|
||||
let _x.1 : PSigma lcErased lcAny := PSigma.mk lcErased ◾ ◾ ◾;
|
||||
let _x.1 : PSigma lcErased lcAny := PSigma.mk ◾ ◾ ◾ ◾;
|
||||
return _x.1
|
||||
---
|
||||
trace: [Compiler.result] size: 5
|
||||
|
|
@ -32,7 +32,7 @@ trace: [Compiler.result] size: 5
|
|||
let _x.10 : EStateM.Result Lean.Exception PUnit PUnit := compile _x.1 _y.7 _y.8 _y.9;
|
||||
cases _x.10 : EStateM.Result Lean.Exception PUnit PUnit
|
||||
| EStateM.Result.ok (a.11 : PUnit) (a.12 : PUnit) =>
|
||||
let _x.13 : EStateM.Result Lean.Exception PUnit PUnit := EStateM.Result.ok Lean.Exception PUnit PUnit _x.2 a.12;
|
||||
let _x.13 : EStateM.Result Lean.Exception PUnit PUnit := EStateM.Result.ok ◾ ◾ ◾ _x.2 a.12;
|
||||
return _x.13
|
||||
| EStateM.Result.error (a.14 : Lean.Exception) (a.15 : PUnit) =>
|
||||
return _x.10
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
return _x.4
|
||||
[Compiler.result] size: 5
|
||||
def foo._closed_9 : Syntax :=
|
||||
let _x.1 := [] _;
|
||||
let _x.1 := [] ◾;
|
||||
let _x.2 := foo._closed_8;
|
||||
let _x.3 := foo._closed_6;
|
||||
let _x.4 := foo._closed_0;
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
let _x.10 := foo._closed_6;
|
||||
let _x.11 := foo._closed_7;
|
||||
let _x.12 := foo._closed_8;
|
||||
let _x.13 := [] _;
|
||||
let _x.13 := [] ◾;
|
||||
let _x.14 := foo._closed_9;
|
||||
let _x.15 := foo._closed_10;
|
||||
let _x.16 := foo._closed_11;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue