AccelerateHS / AccelerateHS/accelerate
[BUG] Imperfect dead code elimination
- Lingua principale
- Haskell
- Stelle
- 1k
- Fork
- 135
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
**Description**
For certain contrived inputs, fusion leaves unused program fragments in the output AST. It seems this can happen when a node was originally used, but due to expression simplification / fusion became unused.
**Steps to reproduce**
Print the following using `show` with `Data.Array.Accelerate` imported unqualified (and `Prelude` not imported)::
```haskell
let arr = use (fromList Z [1 :: Float])
in zipWith
(\x _ -> x)
(generate Z_ (\_ -> 1 :: Exp Float))
(zipWith (\x y -> T2 x y)
(map (\x -> x) arr)
(map (\x -> x) arr))
```
The result is:
```
let
a0 = use (Scalar Z [1.0])
a1 = map (\x0 -> x0) a0
a2 = map (\x0 -> x0) a0
in
generate () (\() -> 1.0)
```
Note that none of `a0`, `a1` and `a2` are actually used.
**Expected behaviour**
The output was expected to be `generate () (\() -> 1.0)`. :)
**Your environment**
- Accelerate: 1.3.0.0; also `203a9271`
- Accelerate backend(s): n/a
- GHC: 8.8.4
- OS: Arch Linux
**Additional context**
AD again delivers in producing obscure code :)
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.