This is a followup to D125754. We introduce two branches, one before the unrolled loop and one before the epilogue (and similar for the prologue case). The previous patch only froze the condition on the first branch.
Rather than independently freezing the second condition, this patch instead freezes TripCount and bases BECount on it. These are the two quantities involved in the conditions, and this ensures that both work on a consistent, non-poisonous trip count.
Really not a fan of this. Your duplicating already subtle logic, and loosing the possibility of SCEV simplification on the BE count.
Doing it once makes sense, but maybe expand both and then freeze the results independently?