[llvm] [PatternMatch] Introduce match functor (NFC) (PR #159386)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 17 09:19:03 PDT 2025
================
@@ -5028,14 +5028,12 @@ static Value *simplifyGEPInst(Type *SrcTy, Value *Ptr,
}
// All-zero GEP is a no-op, unless it performs a vector splat.
- if (Ptr->getType() == GEPTy &&
- all_of(Indices, [](const auto *V) { return match(V, m_Zero()); }))
+ if (Ptr->getType() == GEPTy && all_of(Indices, match_fn(m_Zero())))
return Ptr;
// getelementptr poison, idx -> poison
// getelementptr baseptr, poison -> poison
- if (isa<PoisonValue>(Ptr) ||
- any_of(Indices, [](const auto *V) { return isa<PoisonValue>(V); }))
+ if (isa<PoisonValue>(Ptr) || any_of(Indices, match_fn(m_Poison())))
----------------
lukel97 wrote:
`IsaPred<PoisonValue>`
https://github.com/llvm/llvm-project/pull/159386
More information about the llvm-commits
mailing list