How to disable the simple optimizer

Eric Seidel eric at seidel.io
Fri Jan 26 13:05:53 UTC 2024


I have not been involved in the development of LiquidHaskell for a long time, but this was a problem back when I was involved as well. Back then we installed a custom desugarer that did not inline simple bindings. But I don’t think that approach would work in a plugin setting. 

Sent from my iPhone

> On Jan 26, 2024, at 06:29, Facundo Domínguez <facundo.dominguez at tweag.io> wrote:
> 
> Dear devs,
> 
> I noticed that GHC sometimes inlines bindings during desugaring, e.g
> 
>    foo = z
>      where
>            z  = z1 + z2
>            z1 = 42
>            z2 = 1
> 
> is desugared to
> 
>     foo = 42 + 1
> 
> This inlining is problematic when using a plugin like Liquid Haskell,
> which wants to analyse in Core the local bindings provided by the
> user.
> 
> Until ghc-9.6 LH didn't experience the inlining when using the GHC
> API. And this is despite the fact that  using ghc from the command
> line would seem to always inline during desugaring, even when using
> -O0.
> 
> When using ghc-9.8.1 though, even the output of the GHC API started
> having the bindings inlined. Some debugging with -ddump-ds and
> -ddump-ds-preopt shows that inlining must be happening in the simple
> optimizer.
> 
> Is there anything one could do to disable the optimizations?
> 
> Thanks in advance,
> Facundo
> 
> --
> All views and opinions expressed in this email message are the
> personal opinions of the author and do not represent those of the
> organization or its customers.
> _______________________________________________
> ghc-devs mailing list
> ghc-devs at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs



More information about the ghc-devs mailing list