Improve Simplifier and SpecConstr behaviour
authorsimonpj@microsoft.com <unknown>
Mon, 31 Jan 2011 11:35:29 +0000 (11:35 +0000)
committersimonpj@microsoft.com <unknown>
Mon, 31 Jan 2011 11:35:29 +0000 (11:35 +0000)
commit70ad6e6ad6e2b27ccafc5e8af3b22b22d746e614
treec13525126ffc71fc73e627a7a859bfd72c8247f6
parent209e093599d0d4db5487d124895d817c55b7c052
Improve Simplifier and SpecConstr behaviour

Trac #4908 identified a case where SpecConstr wasn't "seeing" a
specialisation it should easily get.  The solution was simple: see
Note [Add scrutinee to ValueEnv too] in SpecConstr.

Then it turned out that there was an exactly analogous infelicity in
the mighty Simplifer too; see Note [Add unfolding for scrutinee] in
Simplify. This fix is good for Simplify even in the absence of the
SpecConstr change.  (It arose when I moved the binder- swap stuff to
OccAnall, not realising that it *remains* valuable to record info
about the scrutinee of a case expression.  The Note says why.

Together these two changes are unconditionally good.  Better
simplification, better specialisation. Thank you Max.
compiler/simplCore/Simplify.lhs
compiler/specialise/SpecConstr.lhs