[llvm] [LoopUnroll][NFC] Record conditional latch info (PR #182403)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 20 00:53:54 PST 2026
================
@@ -1062,14 +1072,39 @@ llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
changeToUnreachable(Latches.back()->getTerminator(), PreserveLCSSA);
}
+ // After merging adjacent blocks in Latches below:
+ // - CondLatches will list the blocks from Latches that are still terminated
+ // with conditional branches.
+ // - For 1 <= I < CondLatches.size(), IterCounts[I] will store the number of
+ // the original loop iterations through which control flows from
+ // CondLatches[I-1] to CondLatches[I].
+ // - For I == 0 or I == CondLatches.size(), IterCounts[I] will store the
+ // number of the original loop iterations through which control can flow
+ // before CondLatches.front() or after CondLatches.back(), respectively,
+ // without taking the unrolled loop's backedge, if any.
+ // - CondLatchNexts[I] will store the CondLatches[I] branch target for the
+ // next of the original loop's iterations (as opposed to the exit target).
+ assert(ULO.Count == Latches.size() &&
+ "Expected one latch block per unrolled iteration");
+ std::vector<unsigned> IterCounts(1, 0);
----------------
arsenm wrote:
SmallVector?
https://github.com/llvm/llvm-project/pull/182403
More information about the llvm-commits
mailing list