PUBLIC
Never mind, turns out this was because
OmitInterfacePragmas is turned on by default… (why?). After unsetting
OmitInterfacePragmas in the
dflags, I get the expected unfolding, and inter-module inlining works.
Unf{Src=InlineStable, TopLvl=True, Value=True, ConLike=True,
WorkFree=True, Expandable=True,
Guidance=ALWAYS_IF(arity=1,unsat_ok=False,boring_ok=False)
Tmpl= \ (ds [Occ=Once1!] :: A) ->
case ds of {
A1 -> B1;
A2 -> B2
}}
From: Erdi, Gergo
Sent: Wednesday, September 1, 2021 4:53 PM
To: 'GHC' <ghc-devs@haskell.org>
Cc: Montelatici, Raphael Laurent <Raphael.Montelatici@sc.com>; 'gergo@erdi.hu' <gergo@erdi.hu>
Subject: Inter-module inlining doesn't work, Id unfolding seems to be empty -- why?
PUBLIC
Hi,
The attached program uses the GHC 9.0.1 API to typecheck and compile a single module that contains a single definition marked as INLINE:
module Inline where
data A = A1 | A2
data B = B1 | B2
{-# INLINE f #-}
f :: A ->B
f A1 = B1
f A2 = B2
In my bigger program, I noticed that usages of `f` in another module aren’t inlined, so I made the attached experiment: I compile this to desugared, simplified, tidied and prep’d
Core, and then use updateModDetailsIdInfos to fill in the unfolding of `f`. At least, that’s what I thought I do. However, if I print the unfolding of `f` after this process, I get `OtherCon []` instead of what I expected to be a CoreUnfolding. What am I doing
wrong?
Thanks,
Gergo