[llvm] [LV] Vectorize uncountable early exit store loops with combined conditions (PR #205109)
Graham Hunter via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 19 06:02:00 PDT 2026
================
@@ -1701,16 +1764,30 @@ bool LoopVectorizationLegality::isVectorizableEarlyExitLoop() {
}
// The latch block must have a countable exit.
- if (isa<SCEVCouldNotCompute>(
- PSE.getSE()->getPredicatedExitCount(TheLoop, LatchBB, &Predicates))) {
+ if (isa<SCEVCouldNotCompute>(PSE.getSE()->getPredicatedExitCount(
+ TheLoop, LatchBB, &Predicates, ScalarEvolution::SymbolicMaximum))) {
reportVectorizationFailure(
"Cannot determine exact exit count for latch block",
"Cannot vectorize early exit loop",
"UnknownLatchExitCountEarlyExitLoop", ORE, TheLoop);
return false;
}
- assert(llvm::is_contained(CountableExitingBlocks, LatchBB) &&
- "Latch block not found in list of countable exits!");
+
+ if (!is_contained(CountableExitingBlocks, LatchBB)) {
+ // If not a separate counted exit in the latch, then check for a combined
+ // countable and uncountable exit.
+ auto *Br = dyn_cast<CondBrInst>(LatchBB->getTerminator());
+ Value *CountableCond, *Ptr, *Other;
+ Instruction *Load;
+ if (!Br ||
+ !matchCombinedExitCondition(Br->getCondition(), CountableCond, Ptr,
+ Load, Other, *PSE.getSE(), TheLoop)) {
----------------
huntergr-arm wrote:
Done.
https://github.com/llvm/llvm-project/pull/205109
More information about the llvm-commits
mailing list