Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-06 Thread Simon Peyton Jones
, and it works in GHC-the-program? > > > > *From:* Simon Peyton Jones > *Sent:* Wednesday, April 6, 2022 3:37 PM > *To:* Erdi, Gergo > *Cc:* Gergo Érdi ; GHC Devs ; > clash-langu...@googlegroups.com > *Subject:* [External] Re: Avoiding `OtherCon []` unfoldings, restoring

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-06 Thread Erdi, Gergo via ghc-devs
6, 2022 3:37 PM To: Erdi, Gergo Cc: Gergo Érdi ; GHC Devs ; clash-langu...@googlegroups.com Subject: [External] Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings Hi Gergo If you think GHC has a but, can you open a ticket about this? It's all getting lost in a maze

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-06 Thread Simon Peyton Jones
doesn't, in > certain cases. > > -Original Message- > From: ghc-devs On Behalf Of Gergo Érdi > Sent: Saturday, April 2, 2022 11:31 AM > To: Simon Peyton Jones > Cc: GHC Devs ; clash-langu...@googlegroups.com > Subject: [External] Re: Avoiding `OtherCon []` unf

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-05 Thread Erdi, Gergo via ghc-devs
herCon []` unfoldings, restoring definitions from unfoldings I'm using Prep's output (mostly so that it's in ANF) in my full compilation pipeline, so ideally I would save Prep'd Core in my .hi-equivalents so that I don't have to rerun Prep on them every time I use them. I'll get back to you wit

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-05 Thread Zubin Duggal
about. Sebastian -- Originalnachricht -- Von: "Ben Gamari" An: "Simon Peyton Jones" ; "ÉRDI Gergő" Cc: "GHC Devs" ; clash-langu...@googlegroups.com Gesendet: 05.04.2022 15:53:02 Betreff: Re: Avoiding `OtherCon []` unfoldings, restoring defi

Re[2]: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-05 Thread Sebastian Graf
; "ÉRDI Gergő" Cc: "GHC Devs" ; clash-langu...@googlegroups.com Gesendet: 05.04.2022 15:53:02 Betreff: Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings Simon Peyton Jones writes: I don't think any top-level Ids should have OtherCon [] unfold

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-05 Thread Ben Gamari
Simon Peyton Jones writes: > I don't think any top-level Ids should have OtherCon [] unfoldings? If > they do, can you give a repro case? OtherCon [] unfoldings usually mean "I > know this variable is evaluated, but I don't know what its value is. E.g >data T = MkT !a !a > f (MkT x y) =

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-04 Thread Simon Peyton Jones
Merging with my other question about shadowing problems with `toIface*`, in summary it seems that what I really should be doing, is compiling up to Tidy, taking the `CoreBinding`s from there and using `toIfaceBinding` on them to save the definitions. It's hard for me to be helpful here, because

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-01 Thread Gergő Érdi
I'm using Prep's output (mostly so that it's in ANF) in my full compilation pipeline, so ideally I would save Prep'd Core in my .hi-equivalents so that I don't have to rerun Prep on them every time I use them. I'll get back to you with some concrete examples of `OtherCon []` vs. meaningful

Re: Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-01 Thread Simon Peyton Jones
I don't think any top-level Ids should have OtherCon [] unfoldings? If they do, can you give a repro case? OtherCon [] unfoldings usually mean "I know this variable is evaluated, but I don't know what its value is. E.g data T = MkT !a !a f (MkT x y) = ... here x and y have OtherCon []

Re: [clash-language] Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-01 Thread ÉRDI Gergő
On Fri, 1 Apr 2022, Sylvain Henry wrote: The unfolding is present if you add `-fno-omit-interface-pragmas` and dump with `-ddump-simpl`. CorePrep drops unfoldings, see Note [Drop unfoldings and rules] in GHC.CoreToStg.Prep. Thanks, I forgot to mention that I am already using

Re: [clash-language] Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-01 Thread Sylvain Henry
The unfolding is present if you add `-fno-omit-interface-pragmas` and dump with `-ddump-simpl`. CorePrep drops unfoldings, see Note [Drop unfoldings and rules] in GHC.CoreToStg.Prep. The logic for unfolding exposition by Tidy is now in:

Re: [clash-language] Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-01 Thread ÉRDI Gergő
This doesn't quite match my experience. For example, the following toplevel definition gets an `OtherCon []` unfolding: nonEmptySubsequences :: [a] -> [[a]] nonEmptySubsequences [] = [] nonEmptySubsequences (x:xs) = [x] : foldr f [] (nonEmptySubsequences xs) where f ys r = ys : (x:ys) : r

Re: [clash-language] Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-01 Thread Christiaan Baaij
So if I understand correctly, OtherCon is only created here: https://gitlab.haskell.org/ghc/ghc/-/blob/a952dd80d40bf6b67194a44ff71d7bf75957d29e/compiler/GHC/Core/Opt/Simplify.hs#L3071-3077 simplAlt env _ imposs_deflt_cons case_bndr' cont' (Alt DEFAULT bndrs rhs) = assert (null bndrs) $ do

Avoiding `OtherCon []` unfoldings, restoring definitions from unfoldings

2022-04-01 Thread ÉRDI Gergő
Hi, I'm CC-ing the Clash mailing list because I believe they should have encountered the same problem (and perhaps have found a solution to it already!). I'm trying to use `.hi` files compiled with `ExposeAllUnfoldings` set to reconstruct full Core bindings for further processing. By and