chore: remove unnecessary code handling cases of an erased value (#10035)
This is now all handled in `toLCNF`.
This commit is contained in:
parent
ca4322ff09
commit
504d71f268
1 changed files with 6 additions and 14 deletions
|
|
@ -117,20 +117,12 @@ partial def lowerCode (c : LCNF.Code) : M FnBody := do
|
|||
let joinPointId ← getJoinPointValue fvarId
|
||||
return .jmp joinPointId (← args.mapM lowerArg)
|
||||
| .cases cases =>
|
||||
match (← getFVarValue cases.discr) with
|
||||
| .var varId =>
|
||||
return .case cases.typeName
|
||||
varId
|
||||
(← nameToIRType cases.typeName)
|
||||
(← cases.alts.mapM (lowerAlt varId))
|
||||
| .erased =>
|
||||
let #[alt] := cases.alts | panic! "erased inductive should only have one case"
|
||||
match alt with
|
||||
| .alt _ params code =>
|
||||
params.forM (bindErased ·.fvarId)
|
||||
lowerCode code
|
||||
| .default code =>
|
||||
lowerCode code
|
||||
-- `casesOn` for inductive predicates should have already been expanded.
|
||||
let .var varId := (← getFVarValue cases.discr) | unreachable!
|
||||
return .case cases.typeName
|
||||
varId
|
||||
(← nameToIRType cases.typeName)
|
||||
(← cases.alts.mapM (lowerAlt varId))
|
||||
| .return fvarId =>
|
||||
return .ret (← getFVarValue fvarId)
|
||||
| .unreach .. => return .unreachable
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue