[GHC] #8774: Transitivity of Auto-Specialization
GHC
ghc-devs at haskell.org
Tue Sep 27 14:58:48 UTC 2016
#8774: Transitivity of Auto-Specialization
-------------------------------------+-------------------------------------
Reporter: crockeea | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.6.3
Resolution: | Keywords: Inlining
Operating System: Linux | Architecture:
Type of failure: Compile-time | Unknown/Multiple
performance bug | Test Case:
Blocked By: | Blocking:
Related Tickets: #5928, #8668, | Differential Rev(s):
#8099 |
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by crockeea):
I finally got 7.6 installed, and can reproduce the issue. The problem
isn't that a `Foo a` appears, it's that without the SPECIALIZE pragma,
there is a function called `Main.$splus` in core that takes/uses
dictionaries, even though the type is monomorphic:
{{{
Main.$splus
:: Foo.Foo (Foo.Qux GHC.Types.Int)
-> Foo.Foo (Foo.Qux GHC.Types.Int)
-> Foo.Foo (Foo.Qux GHC.Types.Int)
[GblId,
Arity=2,
Str=DmdType SS,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=2, Value=True,
ConLike=True, WorkFree=True, Expandable=True,
Guidance=IF_ARGS [30 30] 110 20}]
Main.$splus =
\ (ds_dJ0 :: Foo.Foo (Foo.Qux GHC.Types.Int))
(ds1_dJ1 :: Foo.Foo (Foo.Qux GHC.Types.Int)) ->
case ds_dJ0 of _ {
Foo.Bar v1_aH6 ->
case ds1_dJ1 of _ {
Foo.Bar v2_aH7 ->
case (Foo.$fNumQux_$c+
@ GHC.Types.Int
GHC.Num.$fNumInt
Data.Vector.Unboxed.Base.$fUnboxInt
v1_aH6
v2_aH7)
}}}
Replying to [comment:10 erikd]:
> Even with ghc 7.6, this seems to specialize correctly:
>
> {{{
> cabal exec -- ghc -fforce-recomp -ddump-simpl -dsuppress-idinfo main.hs
2>&1 | grep Foo
> ...
> @ (Foo.Qux GHC.Types.Int)
> @ (Foo.Foo (Foo.Qux GHC.Types.Int))
> (Foo.$WBar @ (Foo.Qux GHC.Types.Int))
> ...
> }}}
>
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8774#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list