Fusion of a simple listArray call is very fragile
Consider the following (taken from ticket:11707#comment:117750),
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 arr2. 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.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.10.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |