[GHC] #11731: Simplifier: Inlining trivial let can lose sharing
GHC
ghc-devs at haskell.org
Tue Mar 22 10:35:36 UTC 2016
#11731: Simplifier: Inlining trivial let can lose sharing
-------------------------------------+-------------------------------------
Reporter: nomeata | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.1
Resolution: | Keywords:
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 nomeata):
Hmm. Not so easy. Given that problematic code, i.e.
{{{
$s$wwwMe_s49K :: Int -> Int -> GHC.Prim.Int# -> (# Int, Int #)
[LclId, Arity=3, Str=DmdType <L,U(U)><L,1*U(U)><S,1*U>]
$s$wwwMe_s49K =
\ (sc_s49I :: Int) (sc_s49J :: Int) (sc_s49H :: GHC.Prim.Int#) ->
case sc_s49H of ds_X1WV {
__DEFAULT -> $wwwMe_s48A (GHC.Prim.-# ds_X1WV 1#) lvl_s1Z6;
0# ->
case foo @ Int @ Int (sc_s49I, sc_s49J)
of _ [Occ=Dead] { GHC.Types.I# ipv_s1XV [Dmd=<L,A>] ->
let {
b_s1Z1 [Dmd=<L,U(U)>] :: Int
[LclId, Str=DmdType]
b_s1Z1 = sc_s49J } in
let {
a_s1Z0 [Dmd=<L,U(U)>] :: Int
[LclId, Str=DmdType]
a_s1Z0 = sc_s49I } in
(# GHC.Num.$fNumInt_$c+ b_s1Z1 a_s1Z0,
GHC.Num.$fNumInt_$c+ a_s1Z0 b_s1Z1 #)
}
}
}}}
it seems that the `used-once` information is not attached to the
occurrence of `sc_s49J`, but only to the function `$s$wwwMe_s49J` that
binds it. This is confirmed by a `pprTrace` of the `idDemandInfo` in
`exprIsTrivial`:
{{{
exprIsTrivial sc_s49J <L,U>
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11731#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list