Ensure that loop breakers are computed when glomming
authorSimon Peyton Jones <simonpj@microsoft.com>
Fri, 19 Sep 2014 13:51:54 +0000 (14:51 +0100)
committerSimon Peyton Jones <simonpj@microsoft.com>
Tue, 23 Sep 2014 09:35:47 +0000 (10:35 +0100)
commit5fa6e75960b3dddbc72c35eb3fc0f2759215dfbb
treeb6c3ec95a2e799dc3199e05ae998f2301393f5eb
parent38cb5ec13ea7757edf99cda1de9303177b448b88
Ensure that loop breakers are computed when glomming

This patch fixes Trac #9583, a loop in the simplifier.

I thought this was going to be very complicated but it turned out to
be very simple!  The occurrence analyser does something called
"glomming" if the application of imported RULES means that something
that didn't look recursive becomes recursive.  See `Note [Glomming]`
in `OccurAnal`.  Under these circumstances we group all the top-level
bindings into a single massive `Rec`.

But, crucially, I failed to repeat the occurrence analysis on this
glommed set of bindings.  That means that we weren't establishing the
right loop breakers (indeed there were no loop breakers whatsoever),
and that led immediately to the loop. The only surprising this is that
it didn't happen before.
compiler/simplCore/OccurAnal.lhs