Unrolling with more iterations than MaxTripCount is pointless, as those iterations can never be executed. As such, we clamp ULO.Count to MaxTripCount if it is known. This means we no longer need to consider iterations after MaxTripCount for exit folding, and the CompletelyUnroll flag becomes independent of ULO.TripCount.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
LGTM w/one required change.
llvm/lib/Transforms/Utils/LoopUnroll.cpp | ||
---|---|---|
735 | Please add back the j != ExactTripCount bit. I don't have a firm counter example, but the mixture of exitBI specific exact counts and loop maximum counts makes me nervous here. |
llvm/test/Transforms/LoopUnroll/nonlatchcondbr.ll | ||
---|---|---|
161 | I think so. Based on commit history, this is just a positive test that unrolling happens with a non-exiting latch. It still happens, but makes use of the fact that it's a complete unroll now. |
Please add back the j != ExactTripCount bit.
I don't have a firm counter example, but the mixture of exitBI specific exact counts and loop maximum counts makes me nervous here.