#5776: Rule matching regression
-------------------------------------+--------------------------------------
Reporter: rl | Owner:
Type: bug | Status: new
Priority: normal | Component: Compiler
Version: 7.5 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: Runtime performance bug | Testcase:
Blockedby: | Blocking:
Related: |
-------------------------------------+--------------------------------------
This shows up in the Quickhull benchmark from the `vector` package. I
haven't been able to come up with a smaller example so far. To reproduce,
download `vector-0.9.1`, compile `benchmarks/Algo/Quickhull.hs` with `-O2`
and look at the output of simplifier phase 2.
The bit in question is this (in `hsplit`, in the let-binding for
`packed`):
{{{
(Data.Vector.Generic.stream
@ Data.Vector.Unboxed.Base.Vector
@ ((GHC.Types.Double, GHC.Types.Double),
GHC.Types.Double)
$dVector_a1uD
(Data.Vector.Generic.new
@ Data.Vector.Unboxed.Base.Vector
@ ((GHC.Types.Double, GHC.Types.Double),
GHC.Types.Double)
$dVector_a1nZ
(Data.Vector.Generic.New.unstream
@ Data.Vector.Unboxed.Base.Vector
@ ((GHC.Types.Double, GHC.Types.Double),
GHC.Types.Double)
$dVector_a1nZ
...
}}}
The two dictionaries here are actually equivalent:
{{{
$dVector_a1nZ
:: Data.Vector.Generic.Base.Vector
Data.Vector.Unboxed.Base.Vector
((GHC.Types.Double, GHC.Types.Double), GHC.Types.Double)
$dVector_a1nZ =
Data.Vector.Unboxed.Base.$fVectorVector(,)
@ (GHC.Types.Double, GHC.Types.Double)
@ GHC.Types.Double
$dUnbox_s1ne
Data.Vector.Unboxed.Base.$fUnboxDouble
$dVector_a1uD
:: Data.Vector.Generic.Base.Vector
Data.Vector.Unboxed.Base.Vector
((GHC.Types.Double, GHC.Types.Double), GHC.Types.Double)
$dVector_a1uD =
Data.Vector.Unboxed.Base.$fVectorVector(,)
@ (GHC.Types.Double, GHC.Types.Double)
@ GHC.Types.Double
$dUnbox_s1ne
Data.Vector.Unboxed.Base.$fUnboxDouble
}}}
The bit of code in question should be fused away by this rule in
`Data/Vector/Generic.hs`:
{{{
"stream/unstream [Vector]" forall s.
stream (new (New.unstream s)) = s
}}}
But this isn't happening, I suspect because the dictionary arguments don't
match. This was working fine in 7.2.2 which also didn't generate duplicate
dictionary bindings.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5776>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs