[llvm] [LoopRotate] Rotate loop if this makes exit count computable (PR #162654)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 9 06:46:47 PDT 2025
annamthomas wrote:
> this form helps with runtime loop unrolling (see test) and also LoopVectorization requires rotation to make the loop bottom-tested (unconditional latch -> rotate the loop to make latch conditional). There are other passes as well which prefers this "bottom-tested" notation for loops
Just to clarify, the main reason for loop rotation has always been to make the loop bottom tested. . What is being proposed here is a stronger heuristic: make the bottom tested loop countable (if possible).
As shown in the testcase, this helps in loop-unrolling. We also can potentially help vectorize more early-exit loops (as seen in the code referenced in the description).
https://github.com/llvm/llvm-project/pull/162654
More information about the llvm-commits
mailing list