[llvm] r340055 - [TableGen] Don't separately search for DefaultMode when we're going to iterate the set anyway. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 17 10:45:16 PDT 2018


Author: rksimon
Date: Fri Aug 17 10:45:15 2018
New Revision: 340055

URL: http://llvm.org/viewvc/llvm-project?rev=340055&view=rev
Log:
[TableGen] Don't separately search for DefaultMode when we're going to iterate the set anyway. NFCI.

Modified:
    llvm/trunk/utils/TableGen/InfoByHwMode.h

Modified: llvm/trunk/utils/TableGen/InfoByHwMode.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/TableGen/InfoByHwMode.h?rev=340055&r1=340054&r2=340055&view=diff
==============================================================================
--- llvm/trunk/utils/TableGen/InfoByHwMode.h (original)
+++ llvm/trunk/utils/TableGen/InfoByHwMode.h Fri Aug 17 10:45:15 2018
@@ -47,10 +47,12 @@ std::vector<unsigned> union_modes(const
   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;




More information about the llvm-commits mailing list