[GHC] #9718: Avoid TidyPgm predicting what CorePrep will do

GHC ghc-devs at haskell.org
Mon Dec 3 11:50:29 UTC 2018


#9718: Avoid TidyPgm predicting what CorePrep will do
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:  (none)
            Type:  task              |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.3
      Resolution:                    |             Keywords:  CodeGen, CAFs
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 In GHC today, the `CafInfo` for top-level bindings is set by
 `TidyPgm.tidyTopBind`, which in turn uses `hasCafRefs`.

 Note that `hasCafRefs` returns true if

 * The binding mentions CAFFy things
 * The binding ''is'' a CAF

 Notice the the code in `hasCafRefs` has all kind of wierd stuff to do with
 integer literals; this vanishes entirely in your new code because the
 integer-literal expansion is done by the time your new analysis gets to
 it.

 But you may need to look at
 {{{
   is_caf = not (arity > 0 || rhsIsStatic (targetPlatform dflags)
 is_dynamic_name
                                          cvt_literal expr)
 }}}
 The `rhsIsStatic` code (in `CoreUtils`) is basically looking for a thunk.
 But it has some kind of special case for DLLs -- you should ensure that
 your new analysis deals correctly with this.

 `rhsIsStatic` also has code for dealing with partial applications, which I
 don't think we need.  So I think you only need a MUCH simpler function.

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


More information about the ghc-tickets mailing list