We'd added support a while back from breaking the backedge if SCEV can prove the trip count is zero. However, we used the exact trip count which requires *all* exits be analyzeable. I noticed while writing test cases for another patch that this disallows cases where one exit is provably taken paired with another which is unknown. This patch adds the upper bound case.
We could use a symbolic max trip count here instead, but we use an isKnownNonZero filter (presumably for compile time?) for the first-iteration reasoning. I decided this was a more obvious incremental step, and we could go back and untangle the schemes separately.
I find this extra BTC->isZero() check a bit confusing -- unless I'm missing something, the check against getConstantMaxBackedgeTakenCount() should be strictly more powerful, right? For the exact count to return zero all exits must have a constant BECount of zero, so the constant max BE count must also be zero.
(We might also want to drop the isKnownNonZero optimization, as IIRC it had no real impact in practice, but that's a different matter.)