[GHC] #12472: "lazy" is not optimized away

GHC ghc-devs at haskell.org
Sat Aug 6 20:10:51 UTC 2016


#12472: "lazy" is not optimized away
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:  ezyang
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Consider:

 {{{
 import GHC.Magic

 {-# INLINE f #-}
 f x = True

 g = lazy f False
 }}}

 Two things should happen: (1) f should not be inlined, but (2) lazy should
 not be present in final STG (having been eliminated in core prep). I
 thought this was briefly working on HEAD, but apparently it never worked
 at all:

 {{{
 ezyang at sabre:~$ ghc-8.0 -c test.hs -ddump-stg -fforce-recomp -O2

 ==================== STG syntax: ====================
 Test.f [InlPrag=INLINE (sat-args=1)]
   :: forall t_axB. t_axB -> GHC.Types.Bool
 [GblId,
  Arity=1,
  Caf=NoCafRefs,
  Str=DmdType <L,A>,
  Unf=OtherCon []] =
     \r srt:SRT:[] [eta_sHD] GHC.Types.True [];

 Test.g :: GHC.Types.Bool
 [GblId, Str=DmdType] =
     \u srt:SRT:[] [] GHC.Magic.lazy Test.f GHC.Types.False;
 }}}

 Clearly it has not been eliminated.

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


More information about the ghc-tickets mailing list