Note [DataAlt occ info]

GHC/Core/Opt/Simplify/Iteration.hs:3287 compiler

Our general goal is to preserve dead-ness occ-info on the field binders of a
case alternative. Why? It's generally a good idea, but one specific reason is to
support (SEQ4) of Note [seq# magic].

But we have to be careful: even if the field binder is not mentioned in the case
alternative and thus annotated IAmDead by OccurAnal, it might "come back to
life" in one of two ways:

 1. If the case binder is alive, its unfolding might bring back the field
    binder, as in Note [knownCon occ info]:
      case blah of y { I# _ -> $wf (case y of I# v -> v) }
      ==>
      case blah of y { I# v -> $wf v }
 2. Even if the case binder appears to be dead, there is the scenario in
    Note [Add unfolding for scrutinee], in which the fields come back to live
    through the unfolding of variable scrutinee, as follows:
      join j = case x of Just v -> blah v; Nothing -> ... in
      case x of Just _ -> jump j; Nothing -> ...
      ==> { inline j, unfold x to Just v, simplify }
      join j = case x of Just v -> blah v; Nothing -> ... in
      case x of Just v -> blah v; Nothing -> ...

Thus, when we are simply reconstructing a case (the common case), and the
case binder is not dead, or the scrutinee is a variable, we zap the
occurrence info on DataAlt field binders. See `adjustFieldOccInfo`.

References 3

Referenced by 4