[llvm] [LV] Use wide lane masks as the canonical form when tail-folding & interleaving (PR #209484)

Kerry McLaughlin via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 20 08:09:53 PDT 2026


================
@@ -472,6 +478,19 @@ void UnrollState::unrollBlock(VPBlockBase *VPB) {
       continue;
     }
 
+    if (match(&R,
+              m_ActiveLaneMask(m_VPValue(), m_VPValue(Op1), m_VPValue(Op2)))) {
+      auto *ALM = cast<VPInstruction>(&R);
+      auto *User = ALM->getSingleUser();
+      // Widen ActiveLaneMask when used for control flow.
+      if (User && match(User, m_ExtractSubvectorForPart(m_Specific(ALM),
+                                                        m_ZeroInt()))) {
----------------
kmclaughlin-arm wrote:

I've added a new VPInstruction called `ActiveLaneMaskForControlFlow`. I'm happy to change the name to something like `WideActiveLaneMask` if that makes more sense, but I think this better reflects the tail-folding style of loops that this will be created for.

This removes the dependency on a specific instruction sequence, but will hopefully still be useful for @MacDue's predicate-as-counter work.

https://github.com/llvm/llvm-project/pull/209484


More information about the llvm-commits mailing list