Currently we do not adjust ULO.Count after peeling. If we completely
unroll a loop, this means we will end up executing TripCount + PeelCount
number of iterations, instead of TripCount iterations.
There is no point in peeling, if we completely unroll a loop, so we can
just skip it. Alternatively we could adjust ULO.Count, but skipping
peeling should result in a bit less work.
When not completely unrolling a loop, we should be fine, as ULO.TripCount
and ULO.TripCountMultiple are adjusted already.
Fixes PR45939.
Note the adjustments in PR33437, which are due to not peeling in this
case.
This code looks like it needs to be reorganized. We probably shouldn't be doing math using the TripCount, then changing the TripCount before we actually use the results of that math.
Maybe it would be more clear overall to move the peelLoop call into tryToUnrollLoop(), instead of calling it from UnrollLoop.