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