Refactor case-merging and identical-alternative optimisations
authorsimonpj@microsoft.com <unknown>
Thu, 19 Nov 2009 12:37:04 +0000 (12:37 +0000)
committersimonpj@microsoft.com <unknown>
Thu, 19 Nov 2009 12:37:04 +0000 (12:37 +0000)
commit367e603d0136436e783ff9ed610809bf87376262
tree12c0fe050df1ecd5e2e5eff25252fdc7a66e3ca7
parentd21c80ead2ab829c1bb760943233dd9c0751ea13
Refactor case-merging and identical-alternative optimisations

These two optimisations were originally done by SimplUtils.mkCase
*after* all the pieces have been simplified.  Some while ago I
moved them *before*, so they were done by SimplUtils.prepareAlts.
It think the reason was that I couldn't rely on the dead-binder
information on OutIds, and that info is useful in these optimisations.

However,
 (a) Other changes (notably moving case-binder-swap to OccurAnal)
     have meant that dead-binder information is accurate in
     OutIds

 (b) When there is a cascade of case-merges, they happen in
     one sweep if you do it after, but in many sweeps if you
     do it before.  Reason: doing it after means you are looking
     at nice simplified Core.
compiler/simplCore/SimplUtils.lhs
compiler/simplCore/Simplify.lhs