[TableGen] Remove local SmallSet from TypeSetByHwMode::insert.
authorCraig Topper <craig.topper@sifive.com>
Sat, 17 Apr 2021 17:47:04 +0000 (10:47 -0700)
committerCraig Topper <craig.topper@sifive.com>
Sat, 17 Apr 2021 17:48:57 +0000 (10:48 -0700)
This keeps track of which modes are in VVT so we can find out
if a mode is missing later. But we can just ask VVT whether it
has a particular mode.

llvm/utils/TableGen/CodeGenDAGPatterns.cpp

index 4ab2f1c..72fe9fa 100644 (file)
@@ -111,10 +111,8 @@ bool TypeSetByHwMode::insert(const ValueTypeByHwMode &VVT) {
   bool ContainsDefault = false;
   MVT DT = MVT::Other;
 
-  SmallSet<unsigned, 4> Modes;
   for (const auto &P : VVT) {
     unsigned M = P.first;
-    Modes.insert(M);
     // Make sure there exists a set for each specific mode from VVT.
     Changed |= getOrCreate(M).insert(P.second).second;
     // Cache VVT's default mode.
@@ -128,7 +126,7 @@ bool TypeSetByHwMode::insert(const ValueTypeByHwMode &VVT) {
   // modes in "this" that do not exist in VVT.
   if (ContainsDefault)
     for (auto &I : *this)
-      if (!Modes.count(I.first))
+      if (!VVT.hasMode(I.first))
         Changed |= I.second.insert(DT).second;
 
   return Changed;