[llvm] [IR][NFC] Introduce Constant::containsMatchingVectorElement and corresponding matcher m_ContainsMatchingVectorElement (PR #200502)
Sean Clarke via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 4 09:12:59 PDT 2026
================
@@ -309,56 +305,27 @@ bool Constant::isElementWiseEqual(Value *Y) const {
return CmpEq && (isa<PoisonValue>(CmpEq) || match(CmpEq, m_One()));
}
-static bool
-containsUndefinedElement(const Constant *C,
- function_ref<bool(const Constant *)> HasFn) {
- if (auto *VTy = dyn_cast<VectorType>(C->getType())) {
- if (HasFn(C))
+bool Constant::containsVectorElement(
+ function_ref<bool(Constant *)> PredFn) const {
+ if (!getType()->isVectorTy())
+ return false;
+
+ if (Constant *SplatVal = getSplatValue())
----------------
xarkenz wrote:
I couldn't seem to produce an example where this PR produces different IR for scalable vectors, but it is true that the handling is slightly different. With my recent rollbacks, this is less of an issue, I think.
https://github.com/llvm/llvm-project/pull/200502
More information about the llvm-commits
mailing list