[GHC] #13867: Silly definitions remain after SpecConstr
GHC
ghc-devs at haskell.org
Fri Jun 23 14:45:29 UTC 2017
#13867: Silly definitions remain after SpecConstr
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.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 this
{{{
f x xs = let g y = case y of
[] -> 0
(a:as) -> g as
in
g (x:xs)
}}}
Compile with -O2 and we get this
{{{
f =
\ (@ t_axv)
(@ a_axw)
($dNum_axx :: Num a_axw)
(x_amR :: t_axv)
(xs_amS :: [t_axv]) ->
let {
lvl_sxV [Dmd=<S,U>] :: a_axw
[LclId, Str=DmdType]
lvl_sxV = fromInteger @ a_axw $dNum_axx Foo.f1 } in
letrec {
$sg_syr [Occ=LoopBreaker] :: t_axv -> [t_axv] -> a_axw
[LclId, Arity=2, Str=DmdType <L,U><L,U>]
$sg_syr = \ _ [Occ=Dead] (sc1_syq :: [t_axv]) -> g_sxS sc1_syq;
g_sxS [Occ=LoopBreaker] :: [t_axv] -> a_axw
[LclId, Arity=1, Str=DmdType <S,1*U>]
g_sxS =
\ (y_amU :: [t_axv]) ->
case y_amU of _ [Occ=Dead] {
[] -> lvl_sxV;
: a1_amV as_amW -> g_sxS as_amW
}; } in
$sg_syr x_amR xs_amS
}}}
Look at that stupid `$sg_syr` function. It should jolly well be inlined
at its only call site. But it isn't because it's a loop breaker? Why is
it a loop breaker? Because earlier there was a RULE for `g` that mentioned
`$sg`.
This is stupid. It's not killing us but it is obviously wrong.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13867>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list