[TableGen] Don't separately search for DefaultMode when we're going to iterate the...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 17 Aug 2018 17:45:15 +0000 (17:45 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Fri, 17 Aug 2018 17:45:15 +0000 (17:45 +0000)
llvm-svn: 340055

llvm/utils/TableGen/InfoByHwMode.h

index 4838198..7be4678 100644 (file)
@@ -47,10 +47,12 @@ std::vector<unsigned> union_modes(const InfoByHwMode<InfoT> &A,
   for (const auto &P : B)
     U.insert(P.first);
   // Make sure that the default mode is last on the list.
-  bool HasDefault = U.count(DefaultMode);
+  bool HasDefault = false;
   for (unsigned M : U)
     if (M != DefaultMode)
       V.push_back(M);
+    else
+      HasDefault = true;
   if (HasDefault)
     V.push_back(DefaultMode);
   return V;