[llvm] [IR][NFC] Introduce Constant::containsMatchingVectorElement and corresponding matcher (PR #200502)

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 25 03:33:04 PDT 2026


================
@@ -398,7 +398,11 @@ Instruction *InstCombinerImpl::simplifyMaskedScatter(IntrinsicInst &II) {
   if (auto *SplatPtr = getSplatValue(II.getArgOperand(1))) {
     // scatter(splat(value), splat(ptr), non-zero-mask) -> store value, ptr
     if (auto *SplatValue = getSplatValue(II.getArgOperand(0))) {
-      if (maskContainsAllOneOrUndef(ConstMask)) {
+      // non-zero-mask if at least one lane of the mask can be assumed active
+      if (match(ConstMask,
+                m_CombineOr(m_AllOnes(), m_UndefValue(),
+                            m_ContainsMatchingVectorElement(
+                                m_CombineOr(m_AllOnes(), m_UndefValue()))))) {
----------------
artagnon wrote:

With the latest changed, this has unfortunately been uglified more than necessary: could reinstate maskContainsAllOneOrUndef, re-implemented as this, and revert this change?

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


More information about the llvm-commits mailing list