Skip to content
  • Simon Peyton Jones's avatar
    Tidy up the treatment of dead binders · 7e8cba32
    Simon Peyton Jones authored
    This patch does a lot of tidying up of the way that dead variables are
    handled in Core.  Just the sort of thing to do on an aeroplane.
    
    * The tricky "binder-swap" optimisation is moved from the Simplifier
      to the Occurrence Analyser.  See Note [Binder swap] in OccurAnal.
      This is really a nice change.  It should reduce the number of
      simplifier iteratoins (slightly perhaps).  And it means that
      we can be much less pessimistic about zapping occurrence info
      on binders in a case expression.  
    
    * For example:
    	case x of y { (a,b) -> e }
      Previously, each time around, even if y,a,b were all dead, the
      Simplifier would pessimistically zap their OccInfo, so that we
      can't see they are dead any more.  As a result virtually no 
      case expression ended up with dead binders.  This wasn't Bad
      in itself, but it always felt wrong.
    
    * I added a check to CoreLint to check that a dead binder really
      isn't used.  That showed up a couple of bugs in CSE. (Only in
      this sense...
    7e8cba32