This is largely NFC*, in preparation for utilizing ProfileSummaryInfo
and BranchFrequencyInfo analyses. In this patch I am only doing the
splitting for the New PM, but I can do the same for the legacy PM as
a follow-on if this looks good.
*Not NFC since for partial unrolling we lose the updates done to the
loop traversal (adding new sibling and child loops) - according to
Chandler this is not very useful for partial unrolling, but it also
means that the debugging flag -unroll-revisit-child-loops no longer
works for partial unrolling.
A couple other notes/questions:
- I noticed that we are still doing partial unrolling via the new
full unroll pass when there is metadata directing a partial unroll
(see @partial_unroll in test/Transforms/LoopUnroll/revisit.ll).
Should I change the code so this is disallowed when unrolling occurs via
the new full unroll pass? If so, presumably this part of the test
becomes obsolete.
- The LoopPassManager adds a couple of loop canonicalization passes
(LoopSimplifyPass and LCSSAPass). I found I had to add these to
the list of passes for the test/Transforms/LoopUnroll/runtime-loop*.ll
tests to get the same behavior from the partial unroller since it no
longer had those added automatically. In the pipelines we set up in the
PassBuilder, should these be added before the function pass
LoopUnrollPass is added, or can we assume that we would have already
have done any necessary canonicalization through some earlier
invocations of the LoopPassManager?