[GHC] #9291: Don't reconstruct sum types if the type subtly changes

GHC ghc-devs at haskell.org
Thu Dec 28 22:58:32 UTC 2017


#9291: Don't reconstruct sum types if the type subtly changes
-------------------------------------+-------------------------------------
        Reporter:  schyler           |                Owner:  nomeata
            Type:  feature request   |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.8.2
      Resolution:  fixed             |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Runtime           |  Unknown/Multiple
  performance bug                    |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):  Phab:D2871
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by heisenbug):

 @nomeata, I have
 {{{#!hs
 data Boo = Tru | Fal

 quux True = Fal
 quux False = Tru
 {-# NOINLINE quux #-}
 }}}

 which compiles to STG
 {{{
 quux_rCA :: GHC.Types.Bool -> Main.Boo
 [GblId, Arity=1, Caf=NoCafRefs, Str=<S,1*U>, Unf=OtherCon []] =
     sat-only [] \r [ds_s48C] ds_s48C;
 }}}

 I may be mistaken, but does this preserve the original strictness? I looks
 like a regular lambda to me (non-strict).

 The optimization is implemented by `mkStgCase`.

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


More information about the ghc-tickets mailing list