(This is, I think, entirely functionally equivalent to https://reviews.llvm.org/D99929. I just preferred this way of framing the fix. The key difference here is focusing on the connection between the loop trip count and the recurrence. I do think we have a recurrence, it's just a trivially one where only the first iteration runs.)
As shown by PR49856 and the reopened test case on PR49768, my first attempt at accounting for unreachable blocks wasn't quite complete. The new approach simply takes what was previously the assert, turns it into a bail out, and adds a comment explaining why it can happen.
Do we have a guarantee of having no loops in unreachable code?