core to core plugin before inline

Ben Gamari ben at
Tue Feb 18 17:10:01 UTC 2020

Florian Engel <florian.engel at> writes:

> Hello,
> I'm trying to fix an error in  The
> problem is the core to core passes of the plugin are way to slow for
> simple functions.  For slightly more complicated one but still simple
> functions, it fails after a long time of compiling (see the errGrad
> tests in examples/test/Examples.hs).  We suppose that the problem is
> related to inline.  Is there a way to run the core-to-core passes of
> the plugin before inline.
Sure: you specify when your plugin will run when you register it. In the
case of `concat` it appears [1] that you insert your plugin after
several other Core-to-Core passes. IIRC, if you position your plugin
first in the [CoreTodo] returned by `install` then it will run right
after desugaring.

However, note that there is still a bit of inlining done by the "simple
optimiser" (see the CoreOpt module). However, it seems unlikely that
this inlining will cause any trouble for your plugin since it doesn't
duplicate code.


- Ben

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <>

More information about the ghc-devs mailing list