[llvm] [AArch64][SVE2p1] Allow more uses of mask in performActiveLaneMaskCombine (PR #159360)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 07:17:00 PDT 2025


================
@@ -18785,21 +18785,27 @@ performActiveLaneMaskCombine(SDNode *N, TargetLowering::DAGCombinerInfo &DCI,
       (!ST->hasSVE2p1() && !(ST->hasSME2() && ST->isStreaming())))
     return SDValue();
 
-  unsigned NumUses = N->use_size();
+  // Count the number of users which are extract_vectors
+  // The only other valid users for this combine are ptest_first
+  // and reinterpret_cast.
+  unsigned NumExts = count_if(N->users(), [](SDNode *Use) {
+    return Use->getOpcode() == ISD::EXTRACT_SUBVECTOR;
+  });
+
   auto MaskEC = N->getValueType(0).getVectorElementCount();
-  if (!MaskEC.isKnownMultipleOf(NumUses))
+  if (NumExts == 0 || !MaskEC.isKnownMultipleOf(NumExts))
----------------
paulwalker-arm wrote:

Is it possible to move the zero check into `isKnownMultipleOf`?

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


More information about the llvm-commits mailing list