[llvm] [TableGen][GlobalISel] Add rule-wide type inference (PR #66377)
Pierre van Houtryve via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 01:56:07 PST 2023
================
@@ -125,6 +130,20 @@ template <typename Container> auto values(Container &&C) {
return map_range(C, [](auto &Entry) -> auto & { return Entry.second; });
}
+template <typename SetTy> bool doSetsIntersect(const SetTy &A, const SetTy &B) {
+ for (const auto &Elt : A) {
+ if (B.contains(Elt))
+ return true;
+ }
+ return false;
+}
+
+template <class Ty>
+void setVectorUnion(SetVector<Ty> &S1, const SetVector<Ty> &S2) {
+ for (auto SI = S2.begin(), SE = S2.end(); SI != SE; ++SI)
+ S1.insert(*SI);
+}
+
----------------
Pierre-vh wrote:
`SetVector::insert` only returns bool and not a pair so `set_union` cannot be used
```
error: member reference base type 'bool' is not a structure or union
if (S1.insert(*SI).second)
~~~~~~~~~~~~~~^~~~~~~
```
https://github.com/llvm/llvm-project/pull/66377
More information about the llvm-commits
mailing list