Eliminate absent arguments in non-strict positions
One of my programs has this is the output of the post-worker/wrapper simplification:
Rec {
h28_s14N
:: forall t_aMK t_aML.
Main.Nat -> t_aMK -> t_aML -> Main.Nat -> Main.Nat
[LclId,
Arity=4,
Str=DmdType LLLL,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=4, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [0 0 0 0] 6 2}]
h28_s14N =
\ (@ t_aMK)
(@ t_aML)
(az94z94z941_u439_amh :: Main.Nat)
(awS1_u462_ami :: t_aMK)
(awS1_u466_amj :: t_aML)
(x_u590_amk :: Main.Nat) ->
Main.S
(h29_s14O
@ t_aMK
@ t_aML
az94z94z941_u439_amh
awS1_u462_ami
awS1_u466_amj
x_u590_amk)
h29_s14O [Occ=LoopBreaker]
:: forall t_aMK t_aML.
Main.Nat -> t_aMK -> t_aML -> Main.Nat -> Main.Nat
[LclId,
Arity=4,
Str=DmdType LLLS,
Unf=Unf{Src=<vanilla>, TopLvl=True, Arity=4, Value=True,
ConLike=True, Cheap=True, Expandable=True,
Guidance=IF_ARGS [0 0 0 3] 7 0}]
h29_s14O =
\ (@ t_aMK)
(@ t_aML)
(az94z94z941_u439_amm :: Main.Nat)
(awS1_u462_amn :: t_aMK)
(awS1_u466_amo :: t_aML)
(x_u590_amp :: Main.Nat) ->
case x_u590_amp of _ {
Main.Z -> az94z94z941_u439_amm;
Main.S x_u595_amq [Dmd=Just L] ->
h28_s14N
@ t_aMK
@ t_aML
az94z94z941_u439_amm
awS1_u462_amn
awS1_u466_amo
x_u595_amq
}
end Rec }
This is ridiculous because the two awS1 arguments are totally dead. This greatly increases allocations made by the program.
These absent arguments should be removed by the strictness analyser, However I speculate that this occurs because the recursive call to h29 is guarded by a use of the S constructor, making it non-strict.