[llvm] a5e579c - [TableGen] Remove local SmallSet from TypeSetByHwMode::insert.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 17 10:49:27 PDT 2021


Author: Craig Topper
Date: 2021-04-17T10:48:57-07:00
New Revision: a5e579cc2b8db6f088b7401623ad35d6c702c553

URL: https://github.com/llvm/llvm-project/commit/a5e579cc2b8db6f088b7401623ad35d6c702c553
DIFF: https://github.com/llvm/llvm-project/commit/a5e579cc2b8db6f088b7401623ad35d6c702c553.diff

LOG: [TableGen] Remove local SmallSet from TypeSetByHwMode::insert.

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.

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenDAGPatterns.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
index 4ab2f1c69911a..72fe9faf81f80 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.cpp
@@ -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;


        


More information about the llvm-commits mailing list