optimizer: add a hack to try to catch certain optimizer loops.
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.)
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.