[llvm] [IR][Attribute] Add support for intersecting AttributeLists; NFC (PR #109719)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 24 08:03:19 PDT 2024
================
@@ -903,6 +916,98 @@ AttributeSet AttributeSet::removeAttributes(LLVMContext &C,
return get(C, B);
}
+std::optional<AttributeSet>
+AttributeSet::intersectWith(LLVMContext &C, AttributeSet Other) const {
+ if (*this == Other)
+ return *this;
+ AttrBuilder Intersected(C);
+ // Get common set of all attributes then handle each attr according to its
+ // intersect rule.
+ AttributeSet Merged = addAttributes(C, Other);
----------------
andjo403 wrote:
had been nice to have some better way to get all AttrKinds looks like a lot of extra work to make a new AttributeSet only to get a way to iterate over the AttrKinds.
https://github.com/llvm/llvm-project/pull/109719
More information about the llvm-commits
mailing list