core to core plugin before inline

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. Best regards Florian Engel

Florian Engel
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#L139...
participants (2)
-
Ben Gamari
-
Florian Engel