Skip to content
  • Simon Peyton Jones's avatar
    Simplifier improvements · e026bdf2
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    This MR started as: allow the simplifer to do more in one pass,
    arising from places I could see the simplifier taking two iterations
    where one would do.  But it turned into a larger project, because
    these changes unexpectedly made inlining blow up, especially join
    points in deeply-nested cases.
    
    The main changes are below.  There are also many new or rewritten Notes.
    
    Avoiding simplifying repeatedly
    ~~~~~~~~~~~~~~~
    See Note [Avoiding simplifying repeatedly]
    
    * The SimplEnv now has a seInlineDepth field, which says how deep
      in unfoldings we are.  See Note [Inline depth] in Simplify.Env.
      Currently used only for the next point: avoiding repeatedly
      simplifying coercions.
    
    * Avoid repeatedly simplifying coercions.
      see Note [Avoid re-simplifying coercions] in Simplify.Iteration
      As you'll see from the Note, this makes use of the seInlineDepth.
    
    * Allow Simplify.Iteration.simplAuxBind to inline used-once things.
      This is another part of Note [Post-inline for single-use things], ...
    e026bdf2