Unused arguments in join points
Sometimes GHC produces join points with unused parameters. In the example attached, we get join points like the following (when compiled with -O2):
...
$j1_XHI
:: GHC.Prim.Int#
-> GHC.Types.Int
-> (# Unboxed.FingerTree
Unboxed.Size (Unboxed.Node Unboxed.Size b_ahY),
Unboxed.Node Unboxed.Size b_ahY,
Unboxed.FingerTree
Unboxed.Size (Unboxed.Node Unboxed.Size b_ahY) #)
[LclId, Arity=2, Str=DmdType LL]
$j1_XHI =
\ (x2_XE8 :: GHC.Prim.Int#) _ ->
...
which is always called as follows:
...
$j1_XHI x2_XE2 (GHC.Types.I# x2_XE2)
...
i.e. where the second argument is a boxed version of the first. GHC should remove the dead parameter from the join point, to avoid unnecessary boxing.
I get this Core with 7.0.3 and with 7.1.20110629.
I've attached a self-contained example, as small as I can make it. (Making it smaller lets GHC do more unfolding and the problem disappears.) These join points occur inside the 'Deep' case of '$wsplitTree'.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.0.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |