The change fix an assert fail at ScalarEvolutionExpander.cpp (generateOverflowCheck):
const SCEV *ExitCount =
SE.getPredicatedBackedgeTakenCount(AR->getLoop(), Pred);
assert(ExitCount != SE.getCouldNotCompute() && "Invalid loop count");(generateOverflowCheck is called only from expandWrapPredicate)
by inserting an early check on SCEV PredicateBackEdgeCount when createAddRecFromPHIWithCastsImpl