core to core plugin before inline
Ben Gamari
ben at well-typed.com
Tue Feb 18 17:10:01 UTC 2020
Florian Engel <florian.engel at active-group.de> writes:
> Hello,
>
> I'm trying to fix an error in https://github.com/conal/concat. 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.
Cheers,
- Ben
[1] https://github.com/conal/concat/blob/master/plugin/src/ConCat/Plugin.hs#L1390
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20200218/7908aa83/attachment.sig>
More information about the ghc-devs
mailing list