Skip to content

Fix strictness and arity info in SpecConstr

Simon Peyton Jones requested to merge wip/T19780 into master

In GHC.Core.Opt.SpecConstr.spec_one we were giving join-points an incorrect join-arity -- this was fallout from

    commit c71b220491a6ae46924cc5011b80182bcc773a58
    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 (closed). I refactored the code to make the new function calcSpecInfo which treats join points separately.

In doing this I discovered three 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 (closed)). 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.

Merge request reports