This patch limits the default number of iterations performed by InstCombine. It also exposes a new option that allows to specify how many iterations is considered getting stuck in an infinite loop.
Based on experiments performed on real-world C++ programs, InstCombine seems to perform at most ~8-20 iterations, so treating 1000 iterations as an infinite loop seems like a safe choice. See D71145 for details.
The two limits can be specified via command line options.
I'm guessing that the general understanding that ideally these should become 2 in the end.
Now, that might never happen, but that should be the trend.
So far no one seems to have come up with any cases where 1000 limit is reached.
Can we periodically ~halve them, starting now?