Fusion of a simple listArray call is very fragile
|Reported by:||bgamari||Owned by:|
|Type of failure:||Runtime performance bug||Test Case:|
|Related Tickets:||Differential Rev(s):||Phab:D2023|
Consider the following (taken from ticket:11707#comment:2),
module Test where import Data.Array arr, arr2 :: Array Int Int arr = listArray (0,10) [ 1,1,1,1,1,1,1,1,1,1 ] arr2 = listArray (0,10) [ 1,1,1,1,1,1,1,1,1,-1 ]
Given that these are a small array, one might suspect it would be worthwhile for GHC to fuse the lists with
listArray, giving rise to two nicely unrolled construction procedures.
However, if you look at the Core produced by
-O1 this you'll find that this only happens in the case of
arr on the other handle, is mysteriously not fused. The fact that these expressions are so similar and yet produce entirely different code is quite worrying.
Change History (9)
comment:6 Changed 12 months ago by
|Differential Rev(s):||→ Phab:D2023|
|Status:||new → patch|