[GHC] #5889: -fno-prof-count-entries leads to linking errors

GHC ghc-devs at haskell.org
Fri Jan 12 19:14:03 UTC 2018


#5889: -fno-prof-count-entries leads to linking errors
-------------------------------------+-------------------------------------
        Reporter:  akio              |                Owner:  bgamari
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.4.1
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:
Operating System:  Linux             |         Architecture:  x86_64
                                     |  (amd64)
 Type of failure:  GHC rejects       |            Test Case:
  valid program                      |  profiling/should_compile/T5889
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by osa1):

 We discussed this with @bgamari on IRC and I did some experimenting with
 the flags, and I think this story makes sense:

 Answer to question "why are these cost centers eliminated in the
 definition site (in module B) but not in use site (in module A)" is
 because worker for `split` is not inlined in module A. It's inlined when I
 compile module B with `-fspec-constr`:

 {{{
 Inlining done: B.$wsplit
     Inlined fn:  \ (w :: GHC.Integer.Type.Integer)
                    (w1 [Occ=Once!] :: GHC.Base.Maybe
 GHC.Integer.Type.Integer) ->
                    case w1 of {
                      GHC.Base.Nothing ->
                        (# scc<split> B.plus_noinline w B.split3,
                           scc<split> B.plus_noinline w B.split2 #);
                      GHC.Base.Just m ->
                        case scc<split> GHC.Integer.Type.eqInteger# w
 B.split1 of {
                          __DEFAULT ->
                            scc<split>
                            B.split_$s$wsplit m
 (GHC.Integer.Type.minusInteger w B.split3);
                          1# -> (# m, m #)
                        }
                    }
     Cont:   ApplyToVal nodup w
             ApplyToVal nodup w1
             Select nodup ww
             Stop[BoringCtxt] (GHC.Integer.Type.Integer,
                               GHC.Integer.Type.Integer)
 }}}

 with this I no longer get any linker errors.

 In comment:19 I said that `SpecConstr` pass doesn't actually change the
 program -- this is correct, we don't need `SpecConstr` in A, we need it in
 B to make the worker for `split` available in module A. Once we compile
 `B` with `-fspec-constr` the worker becomes available in when compiling
 `A`.

 Hopefully this explains.

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


More information about the ghc-tickets mailing list