#11731: Simplifier: Inlining trivial let can lose sharing -------------------------------------+------------------------------------- Reporter: nomeata | Owner: Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Phab:D2073 Wiki Page: | -------------------------------------+------------------------------------- Comment (by nomeata): With the late demand analysis, suddenly demand signatures involving free variables turn up in `-ddump-simpl`: {{{ Roman.foo_$s$wgo [Occ=LoopBreaker] :: GHC.Prim.Int# -> GHC.Prim.Int# -> GHC.Prim.Int# -[GblId, Arity=2, Caf=NoCafRefs, Str=<L,U><L,U>] +[GblId, Arity=2, Caf=NoCafRefs, Str=<L,U><S,U>] Roman.foo_$s$wgo = \ (sc :: GHC.Prim.Int#) (sc1 :: GHC.Prim.Int#) -> let { m :: GHC.Prim.Int# - [LclId] + [LclId, Str={s1Yc-><S,A>}] ... }}} As this contains uniques, this breaks a few test cases. So it seems that previously, this information has been removed somewhere (in the simplifier or so). With DmdAnal running right at the end, this is not happening. So I wondered if `CoreTidy` should remove them, but there it says {{{ -- Note [Tidy IdInfo] -- We need to keep around any interesting strictness and -- demand info because later on we may need to use it when -- converting to A-normal form. -- eg. -- f (g x), where f is strict in its argument, will be converted -- into case (g x) of z -> f z by CorePrep, but only if f still -- has its strictness info. -- -- Similarly for the demand info - on a let binder, this tells -- CorePrep to turn the let into a case. }}} Questions: * At CorePrep time, should there still be a demand environment in the strictness signatures? (Note that the `Binary` instance does _not_ serialize the environment, but discards it). * If not, should I remove the environment in TidyCore? * Where was it removed before? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11731#comment:41> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler