aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index c5874c58..f2ba61a 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -1800,12 +1800,10 @@ AttributeList::intersectWith(LLVMContext &C, AttributeList Other) const {
if (*this == Other)
return *this;
- // At least for now, only intersect lists with same number of params.
- if (getNumAttrSets() != Other.getNumAttrSets())
- return std::nullopt;
-
SmallVector<std::pair<unsigned, AttributeSet>> IntersectedAttrs;
- for (unsigned Idx : indexes()) {
+ auto IndexIt =
+ index_iterator(std::max(getNumAttrSets(), Other.getNumAttrSets()));
+ for (unsigned Idx : IndexIt) {
auto IntersectedAS =
getAttributes(Idx).intersectWith(C, Other.getAttributes(Idx));
// If any index fails to intersect, fail.