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
12 changes: 12 additions & 0 deletions src/Lean/Compiler/LCNF/Simp/Main.lean
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,18 @@ partial def simp (code : Code) : SimpM Code := withIncRecDepth do
params.forM (eraseParam ·)
markSimplified
return k
if alts.all (·.getCode matches .unreach ..) then
alts.forM (liftM <| ·.getParams.forM eraseParam)
markSimplified
return .unreach resultType
/-
We considered handling a case where we drop a cases if it only has one non-unreachable
branch and doesn't rely on the params of that branch here. However, this has the potential
to hinder reuse in later passes as we loose information about the shape of a variable. We
might be able to reintroduce this at a later point if we track this information different
from cases.
-/

markUsedFVar discr
return code.updateCases! resultType discr alts
end
Loading