Overapproximation of loopbreakers due to unfoldings

Matthew Pickering matthewtpickering at gmail.com
Fri Sep 15 15:46:17 UTC 2017


I have been puzzling over the example presented by Harendra in #14211
for the last two days.

Ultimately it led me to discover that if a self-recursive definition
is marked with an INLINE pragma then it will always be marked as a
loopbreaker.

This is undesirable in this case as the simplifier ends up with in the
first pass..

bindWith = ... bindWith ...
=>
bindWith = bindWith_abc |> co
bindWith_abc = ... bindWith ...

So we can then inline `bindWith` into the RHS of `bindWith_abc` and
create a single self-recursive function rather than a mutually
recursive block. Marking `bindWith` as `INLINE` means that both
`bindWith` and `bindWith_abc` are marked as loopbreakers.

Mutual recursive blocks are bad as they completely stop the static
argument transformation from working.

My question is, why is it necessary to mark "bindWith" as a
loopbreaker in the current module? Are there any tickets or notes
which discuss this problem?

Matt


More information about the ghc-devs mailing list