[llvm] [IR][NFC] Introduce Constant::containsMatchingVectorElement and corresponding matcher m_ContainsMatchingVectorElement (PR #200502)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 5 08:08:56 PDT 2026
================
@@ -390,15 +388,16 @@ Instruction *InstCombinerImpl::simplifyMaskedScatter(IntrinsicInst &II) {
if (!ConstMask)
return nullptr;
- // If the mask is all zeros or poison, a scatter does nothing.
- if (match(ConstMask, m_ZeroOrPoison()))
+ // If the mask is all zeros, a scatter does nothing.
+ if (maskIsAllZeroOrUndef(ConstMask))
return eraseInstFromFunction(II);
// Vector splat address -> scalar store
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)) {
+ if (match(ConstMask, m_ContainsMatchingVectorElement(
+ m_CombineOr(m_AllOnes(), m_UndefValue())))) {
----------------
artagnon wrote:
Just noting: should be able to change this to m_AllOnes() in a follow-up, hopefully with test updates?
https://github.com/llvm/llvm-project/pull/200502
More information about the llvm-commits
mailing list