Skip to content
  • Ömer Sinan Ağacan's avatar
    StgLint overhaul · 7f389a58
    Ömer Sinan Ağacan authored
    - Remove all type checks
    - Check two STG invariants (no unboxed let bindings, variables defined
      before used) and post-unarisation invariants.
    
    See the module header and #14787.
    
    This version validates with `-dstg-lint` added to `GhcStage2HcOpts` and
    `GhcLibHcOpts` and `EXTRA_HC_OPTS`.
    
    Unarise changes:
    
    - `unariseConArgBinder` and `unariseFunArgBinder` functions were almost
      the same; only difference was when unarising fun args we keep void
      args while in con args we drop them. A new function `unariseArgBinder`
      added with a `Bool` argument for whether we're unarising a con arg.
      `unariseConArgBinder` and `unariseFunArgBinder` are now defined as
    
          unariseConArgBinder = unarsieArgBinder True  -- data con
          unariseFunArgBinder = unariseArgBinder False -- not data con
    
    - A bug in `unariseConArgBinder` and `unariseFunArgBinder` (which are
      just calls to `unariseArgBinder` now) that invalidated the
      post-unarise invariants when the argument has single type rep (i.e.
      `length (typePrimRep x) == 1`) fixed. This isn't a correctness issue
      (it's fine not to unarise if a variable is already represented as
      single value), but it triggers StgLint.
    
    Test Plan:
    - Pass testsuite with `-dstg-lint` [done]
    - Boot stage2 (including libraries) with `-dstg-lint` [done]
    
    Reviewers: simonpj, bgamari
    
    Reviewed By: bgamari
    
    Subscribers: duog, rwbarton, thomie, carter
    
    GHC Trac Issues: #14787
    
    Differential Revision: https://phabricator.haskell.org/D4404
    7f389a58