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?

 

Here’s my thought

 

All of these things are doubtless only sort-of-true.   Concrete examples to the contrary would be useful.

 

Simon

-----Original Message-----

From: ghc-devs [mailto:ghc-devs-bounces@haskell.org] On Behalf Of Joachim Breitner

Sent: 20 March 2018 13:42

To: ghc-devs@haskell.org

Subject: Re: Why does SpecConstr run far later than specialisation

 

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@joachim-breitner.de

  https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.joachim-breitner.de%2F&data=04%7C01%7Csimonpj%40microsoft.com%7Cff102ef484bd411807e108d58e68796c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636571501747132026%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-1&sdata=R1t%2FW5BJeJPausEfMIfbYOgwj5qLaX5Hda4Z4LwDoJk%3D&reserved=0