[llvm] r331081 - Attempt to fix remaining build failures after r331071 by changing the tuple to a struct

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 27 14:03:27 PDT 2018


Author: dsanders
Date: Fri Apr 27 14:03:27 2018
New Revision: 331081

URL: http://llvm.org/viewvc/llvm-project?rev=331081&view=rev
Log:
Attempt to fix remaining build failures after r331071 by changing the tuple to a struct

Some of the bots were failing in a different way to the others. These were
unable to compare tuples. Fix this by changing to a struct, thereby avoiding
the quirks of tuples.


Modified:
    llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
    llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp

Modified: llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h?rev=331081&r1=331080&r2=331081&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h (original)
+++ llvm/trunk/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h Fri Apr 27 14:03:27 2018
@@ -161,6 +161,17 @@ using LegalizeMutation =
     std::function<std::pair<unsigned, LLT>(const LegalityQuery &)>;
 
 namespace LegalityPredicates {
+struct TypePairAndMemSize {
+  LLT Type0;
+  LLT Type1;
+  uint64_t MemSize;
+
+  bool operator==(const TypePairAndMemSize &Other) const {
+    return Type0 == Other.Type0 && Type1 == Other.Type1 &&
+           MemSize == Other.MemSize;
+  }
+};
+
 /// True iff P0 and P1 are true.
 LegalityPredicate all(LegalityPredicate P0, LegalityPredicate P1);
 /// True iff the given type index is one of the specified types.
@@ -175,7 +186,7 @@ typePairInSet(unsigned TypeIdx0, unsigne
 /// specified type pairs.
 LegalityPredicate typePairAndMemSizeInSet(
     unsigned TypeIdx0, unsigned TypeIdx1, unsigned MMOIdx,
-    std::initializer_list<std::tuple<LLT, LLT, unsigned>> TypesAndMemSizeInit);
+    std::initializer_list<TypePairAndMemSize> TypesAndMemSizeInit);
 /// True iff the specified type index is a scalar.
 LegalityPredicate isScalar(unsigned TypeIdx);
 /// True iff the specified type index is a scalar that's narrower than the given
@@ -346,7 +357,8 @@ public:
   /// The instruction is legal when type indexes 0 and 1 along with the memory
   /// size is any type and size tuple in the given list.
   LegalizeRuleSet &legalForTypesWithMemSize(
-      std::initializer_list<std::tuple<LLT, LLT, unsigned>> TypesAndMemSize) {
+      std::initializer_list<LegalityPredicates::TypePairAndMemSize>
+          TypesAndMemSize) {
     return legalIf(LegalityPredicates::typePairAndMemSizeInSet(
         0, 1, /*MMOIdx*/ 0, TypesAndMemSize));
   }

Modified: llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp?rev=331081&r1=331080&r2=331081&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/LegalityPredicates.cpp Fri Apr 27 14:03:27 2018
@@ -43,12 +43,11 @@ LegalityPredicate LegalityPredicates::ty
 
 LegalityPredicate LegalityPredicates::typePairAndMemSizeInSet(
     unsigned TypeIdx0, unsigned TypeIdx1, unsigned MMOIdx,
-    std::initializer_list<std::tuple<LLT, LLT, unsigned>> TypesAndMemSizeInit) {
-  SmallVector<std::tuple<LLT, LLT, unsigned>, 4> TypesAndMemSize = TypesAndMemSizeInit;
+    std::initializer_list<TypePairAndMemSize> TypesAndMemSizeInit) {
+  SmallVector<TypePairAndMemSize, 4> TypesAndMemSize = TypesAndMemSizeInit;
   return [=](const LegalityQuery &Query) {
-    std::tuple<LLT, LLT, unsigned> Match =
-        std::make_tuple(Query.Types[TypeIdx0], Query.Types[TypeIdx1],
-                        Query.MMODescrs[MMOIdx].Size);
+    TypePairAndMemSize Match = {Query.Types[TypeIdx0], Query.Types[TypeIdx1],
+                                Query.MMODescrs[MMOIdx].Size};
     return std::find(TypesAndMemSize.begin(), TypesAndMemSize.end(), Match) !=
            TypesAndMemSize.end();
   };




More information about the llvm-commits mailing list