Some filters cause us to get stuck in a loop where the optimizer does
nothing other than swap two chunks of code over and over again, rather
than reaching a fixed point. For now, if we have performed an optimizer
pass that has done nothing other than move code, we start a counter and,
if we have 100 passes that have done nothing other than move code, we
assume we're in a cycle.
(Yes, we need a non-heuristic way of detecting, or preventing, such a
cycle.)
This should address this oss-fuzz issue:
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=10930
as well as GitHub issue #112.
GitHub pull request #777 is for the same issue, but just imposes a
maximum of 1000 optimizer passes; this fix allows more passes, as long
as we keep doing things *other* than just moving code.