[GHC] #11731: Simplifier: Inlining trivial let can lose sharing

GHC ghc-devs at haskell.org
Thu Mar 31 07:12:03 UTC 2016


#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:D2064
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 * The awkwardness of not recording top-level 1* info is that we'd need a
 demand-analyser flag to tell it whether to do so or not.

 * I've just realised that this final sweep (dmd anal only) must be just
 before `CoreTidy`. Reason: currently anyway, `CoreTidy` establishes the
 exported strictness signatures.  We do want to export `f` with a "I use my
 arg at most once" `1*` annotation.  So we want to pin in reliable info
 just before we freeze it for export, and then not invalidate it.

   One thing I have longed to do for some time is to get CAF info from the
 STG form, and combine that CAF info into the `ModIface` bindings.
 Currently we ''predict'' what it'll be at `CoreTidy`, which is fragile.
 Maybe the same holds for strictness/usage info.

 * `OneShot` annotations on lambda binders are a different matter. They say
 something about the use of the ''function'', not about the use of the
 binder in the function body.  Can a `OneShot` annotation go wrong? Yes if
 we call that function twice instead of once.  But GHC really is pretty
 paranoid about duplicating arbitrary amounts of work so we are at least
 much safer here.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11731#comment:24>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list