[llvm] [SimplifyCFG][Attributes] Enabling sinking calls with differing number of attrsets (PR #110896)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 2 10:46:58 PDT 2024


================
@@ -1800,14 +1801,20 @@ 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 IntersectedAS =
-        getAttributes(Idx).intersectWith(C, Other.getAttributes(Idx));
+  SmallSet<unsigned, 8> AllIndexes{};
+  AllIndexes.insert(indexes().begin(), indexes().end());
+  AllIndexes.insert(Other.indexes().begin(), Other.indexes().end());
----------------
goldsteinn wrote:

Yeah that seems cleaner.

https://github.com/llvm/llvm-project/pull/110896


More information about the llvm-commits mailing list