aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorNoah Goldstein <goldstein.w.n@gmail.com>2024-10-02 11:35:03 -0500
committerNoah Goldstein <goldstein.w.n@gmail.com>2024-10-02 15:15:07 -0500
commite343af777ef51c4496e7fb2689735866bc617897 (patch)
tree691d609b23c1989609944cbdb9cb99a0f048e23a /llvm/lib/IR/Attributes.cpp
parentbaf008ac29e582003f6fe6ec096a6d18bbb43d49 (diff)
downloadllvm-e343af777ef51c4496e7fb2689735866bc617897.zip
llvm-e343af777ef51c4496e7fb2689735866bc617897.tar.gz
llvm-e343af777ef51c4496e7fb2689735866bc617897.tar.bz2
[SimplifyCFG][Attributes] Enabling sinking calls with differing number of attrsets
Prior impl would fail if the number of attribute sets on the two calls wasn't the same which is unnecessary as long as we aren't throwing away and must-preserve attrs. Closes #110896
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.