Why does SpecConstr run far later than specialisation

Joachim Breitner mail at joachim-breitner.de
Tue Mar 20 13:42:16 UTC 2018


Hi,

Am Dienstag, den 20.03.2018, 13:23 +0000 schrieb Matthew Pickering:
> As far as I understand it, the goals of SpecConstr and specialisation
> are the same. One works for
> normal value arguments and one works for special type class dictionary
> arguments.
> 
> However, looking at the pass order in `SimplCore`, specialisation runs
> very early before any major simplification but SpecConstr runs very
> late right at the end of the pipeline.
> 
> Does anyone know the justification for this? It seems intuitively that
> they should work in the same way.

Just a guess: We want the demand analyzer to run before SpecConstr,
because I expect that there are many functions where both the demand
analyzer are happy to do something, and SpecConstr is happy to do
something, but the worker-wrapper done by DmdAnal is strictly
preferable (no code duplication, for example.)

But the Specializer and the demand analyzer have no overlap, and we we
do want to strictness-analyzer the type-class-specialized code.

But as I said, it’s just a guess.

Cheers,
Joachim

-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.de
  https://www.joachim-breitner.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20180320/b8a48644/attachment.sig>


More information about the ghc-devs mailing list