[llvm] [LV] Vectorize uncountable early exit store loops with combined conditions (PR #205109)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 17 07:52:50 PDT 2026
================
@@ -4659,6 +4659,61 @@ bool VPlanTransforms::handleUncountableEarlyExits(
}
}
+ // If we didn't find any, perhaps the exit was combined.
+ if (Exits.empty() && Plan.getExitBlocks().size() == 1) {
+ // TODO: Make this work with other styles.
+ if (Style != UncountableExitStyle::MaskedHandleExitInScalarLoop)
+ return false;
+
+ // TODO: Relax assumptions to cover more loops.
+ VPValue *Uncounted = nullptr;
+ VPValue *Counted = nullptr;
+ auto *IV = cast<VPSingleDefRecipe>(&HeaderVPBB->front());
+ VPRecipeBase *LatchBr = LatchVPBB->getTerminator();
+
+ if (!match(
+ LatchBr,
+ m_BranchOnCond(m_c_LogicalOr(
+ m_VPValue(Uncounted,
+ m_Cmp(m_VPInstruction<Instruction::Load>(m_VPValue()),
+ m_VPValue())),
+ m_VPValue(Counted, m_Cmp(m_Add(m_Specific(IV), m_VPValue()),
+ m_VPValue()))))))
+ return false;
+
+ // TODO: Exits currently assumes the ExitBlock must be an existing IR
+ // basic block, and MiddleVPBB doesn't qualify. For now, hack around
+ // this and duplicate the work from below.
+ // TODO: Find a nicer way to integrate this into the rest of the function.
----------------
sdesmalen-arm wrote:
Are there any inherent complexities to do this?
https://github.com/llvm/llvm-project/pull/205109
More information about the llvm-commits
mailing list