[llvm] [LoopVectorize] Generate wide active lane masks (PR #147535)
Kerry McLaughlin via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 18 06:21:59 PDT 2025
================
@@ -1446,6 +1448,92 @@ static bool isConditionTrueViaVFAndUF(VPValue *Cond, VPlan &Plan,
return SE.isKnownPredicate(CmpInst::ICMP_EQ, VectorTripCount, C);
}
+static bool useWideActiveLaneMask(VPlan &Plan, ElementCount VF, unsigned UF) {
+ VPRegionBlock *VectorRegion = Plan.getVectorLoopRegion();
+ VPBasicBlock *ExitingVPBB = VectorRegion->getExitingBasicBlock();
+ auto *Term = &ExitingVPBB->back();
+
+ using namespace llvm::VPlanPatternMatch;
+ if (!EnableWideActiveLaneMask || !VF.isVector() || UF == 1 ||
+ !match(Term, m_BranchOnCond(m_Not(m_ActiveLaneMask(
----------------
kmclaughlin-arm wrote:
The "using tail folding without runtime checks" requirement is no longer accurate since removing the restriction that the tail folding style must be `DataAndControlFlowWithoutRuntimeCheck`.
There is nothing preventing this transform from applying in other cases, as long as the ActiveLaneMask instruction is being used for data and control flow in the loop, which I believe checking for the pattern `!match(Term, m_BranchOnCond(m_Not(m_ActiveLaneMask(...` here is sufficient for. I will update the commit message.
https://github.com/llvm/llvm-project/pull/147535
More information about the llvm-commits
mailing list