[llvm] [LV] Rename replaceMaskWithCompare -> replaceMaskWithCompareForScalarPlan (PR #216340)

Kerry McLaughlin via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 03:17:56 PDT 2026


https://github.com/kmclaughlin-arm updated https://github.com/llvm/llvm-project/pull/216340

>From 509d3d4fc22eaf61554cf921bf043762baf173f6 Mon Sep 17 00:00:00 2001
From: Kerry McLaughlin <kerry.mclaughlin at arm.com>
Date: Fri, 14 Aug 2026 15:23:22 +0000
Subject: [PATCH] [LV] Rename replaceMaskWithCompare ->
 replaceMaskWithCompareForScalarPlan

---
 llvm/lib/Transforms/Vectorize/VPlan.h             | 6 +++---
 llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index deabeb97183c2..fe1342e4309ab 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -1243,9 +1243,9 @@ class LLVM_ABI_FOR_TEST VPInstruction : public VPRecipeWithIRFlags,
     // Creates a mask where each lane is active (true) whilst the current
     // counter (first operand + index) is less than the second operand. i.e.
     //    mask[i] = icmpt ult (op0 + i), op1
-    // ActiveLaneMask is used for tail-folding, with the exception of the
-    // DataAndControlFlow style. The size of the mask returned is VF.
-    // When unrolled, ActiveLaneMask is duplicated.
+    // ActiveLaneMask is used for early-exit loops with stores, plus tail
+    // folding for all styles except DataAndControlFlow. The size of the
+    // mask returned is VF. When unrolled, ActiveLaneMask is duplicated.
     ActiveLaneMask,
     // As above, but takes an additional operand (Multiplier). The size of
     // the mask returned is VF * Multiplier (UF, op2).
diff --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index baf1716c078cd..2cc9331668703 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -2041,7 +2041,8 @@ static bool isConditionTrueViaVFAndUF(VPValue *Cond, VPlan &Plan,
 // Replaces ExtractVectorForPart instructions with ICMP when the VF is scalar
 // and the source is a WideActiveLaneMask. The unused mask is removed later
 // when removing dead recipes.
-static bool replaceMaskWithCompare(VPlan &Plan, ElementCount BestVF) {
+static bool replaceMaskWithCompareForScalarPlan(VPlan &Plan,
+                                                ElementCount BestVF) {
   if (!BestVF.isScalar())
     return false;
 
@@ -2145,7 +2146,7 @@ void VPlanTransforms::optimizeForVFAndUF(VPlan &Plan, ElementCount BestVF,
 
   bool MadeChange =
       simplifyBranchConditionForVFAndUF(Plan, BestVF, BestUF, PSE);
-  MadeChange |= replaceMaskWithCompare(Plan, BestVF);
+  MadeChange |= replaceMaskWithCompareForScalarPlan(Plan, BestVF);
   MadeChange |= optimizeVectorInductionWidthForTCAndVFUF(Plan, BestVF, BestUF);
 
   if (MadeChange) {



More information about the llvm-commits mailing list