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

GHC ghc-devs at haskell.org
Thu Mar 31 07:48:19 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 nomeata):

 > 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.

 Not too awkward, there is `AnalEnv` that can hold on to it.

 But alternatively, we could do a second sweep that goes through the AST
 after DmdAnal and remove the bits we want removed. This would allow the
 demand analyzer to set and make use of `1*` internally, e.g. during fixed-
 point iteration and such. This pass  would also allow us to set the
 `OneShot` annotations on lambda binders based on the demand on the
 function, before we remove it – the occurrence analyzer cannot do it for
 us any more.

 Or we move the onus of removing invalidated demand signatures onto the
 pass that actually invalidates them, and just be much more aggressive
 about this. The occurrence analyzer (if we think of it as the first thing
 done by the simplifier) would be a natural choice, with the added benefit
 that it can still use the information to set `OneShot` information before
 zapping it.

 > Can a `OneShot` annotation go wrong?

 I cannot construct an example out of my head that would still work if we
 eradicated thanks that are wrongly marked as single entry, so we might be
 safe.

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


More information about the ghc-tickets mailing list