Skip to content
  • Simon Peyton Jones's avatar
    Fix strictness and arity info in SpecConstr · c7717949
    Simon Peyton Jones authored and Marge Bot's avatar Marge Bot committed
    In GHC.Core.Opt.SpecConstr.spec_one we were giving join-points an
    incorrect join-arity -- this was fallout from
    
        commit c71b2204
        Author: Simon Peyton Jones <simonpj@microsoft.com>
        Date:   Thu Apr 8 23:36:24 2021 +0100
    
            Improvements in SpecConstr
    
            * Allow under-saturated calls to specialise
              See Note [SpecConstr call patterns]
              This just allows a bit more specialisation to take place.
    
    and showed up in #19780. I refactored the code to make the new
    function calcSpecInfo which treats join points separately.
    
    In doing this I discovered two other small bugs:
    
    * In the Var case of argToPat we were treating UnkOcc as
      uninteresting, but (by omission) NoOcc as interesting. As a
      result we were generating SpecConstr specialisations for functions
      with unused arguments.  But the absence anlyser does that much
      better; doing it here just generates more code.  Easily fixed.
    
    * The lifted/unlifted test in GHC.Core.Opt.WorkWrap.Utils.mkWorkerArgs
      was back to front (#19794).  Easily fixed.
    
    * In the same function, mkWorkerArgs, we were adding an extra argument
      nullary join points, which isn't necessary.  I added a test for
      this.  That in turn meant I had to remove an ASSERT in
      CoreToStg.mkStgRhs for nullary join points, which was always bogus
      but now trips; I added a comment to explain.
    c7717949