[GHC] #8635: GHC optimisation flag ignored when importing a local module with derived type classes

GHC ghc-devs at haskell.org
Sat Dec 28 10:29:56 UTC 2013


#8635: GHC optimisation flag ignored when importing a local module with derived
type classes
-------------------------------------+------------------------------------
        Reporter:  NeilMitchell      |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.6.3
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by simonpj):

 I agree this is strange behaviour.  Here's why it happens.

  * With `--make` GHC reads each library interface file only once, e.g.
 that defining equality for `Int`.
  * Without `-O` (i.e. with `-O0`), GHC sets `-fignore-interface-pragmas`.
  * When reading an interface file with `-fignore-interface-pragmas`, GHC
 skips all the unfoldings and other inessential info.
  * Without the `deriving` stuff, there's no reason to read the crucial
 interface file when compiling `Foo`.  So it's read when compiling `Bar`,
 and hence when `-O` is set.
  * With the `deriving` clause, the crucial interface file is read when
 compiling `Foo`, but the unfoldings are skipped, and hence are unavailable
 when compiling `Bar`.

 You can get the behaviour you want by adding `-fno-ignore-interface-
 pragmas`.  Maybe this should be the case with `--make`?  But that choice
 would have the following downside: with `-fno-ignore-interface-pragamas`
 all unfoldings are read in, and may subsequently get used even by the
 modest optimisation done with `-O0`.  Mind you, that ''might'' conceivably
 be a win.  Maybe compile time and binary size would only increase
 marginally, but execution time would fall significantly?

 Would someone like to try the effect on compile times, binary size, and
 execution time, of using `-fno-ignore-interface-pragmas` with `-O0`?

 Simon

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


More information about the ghc-tickets mailing list