I was stepping through some of the callstacks in the example from D99759 and noticed a potential compile-time improvement.
This is really 2 patches, but I've put them together to make it easier to see if it does anything to help real-world compile-time:
- Improve the logic in isNonZeroRecurrence() to handle the case of a negative-stepping phi+add pair.
- Limit a call from instsimplify to isKnownNonEqual() to avoid a pile of redundant analysis.
The first step is needed to avoid a regression - the test example shown here is caught by isKnownNonEqual() but missed by isNonZeroRecurrence() without this patch.
This makes a degenerate test based on PR49785 about 40x faster (25 sec -> 0.6 sec), but it does not address the larger question of how to limit computeKnownBitsFromAssume(). Ie, the original test there is still infinite-time for all practical purposes.