Rule matching regression
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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.5 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |