[llvm] b3417d8 - [TableGen] Change std::vector to SmallVector

Nadav Rotem via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 11:33:04 PDT 2020


Author: Nadav Rotem
Date: 2020-07-16T11:32:44-07:00
New Revision: b3417d80aed708d64e810ed9c5d0d0fb84b65715

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

LOG: [TableGen] Change std::vector to SmallVector

The size of VTList that is pushed into this container is usually 1, but
often 6 or 7. Change the vector to SmallVector to eliminate frequent
mallocs.  This happens hundreds of thousands of times in each tablegen
execution during the LLVM/clang build.

https://reviews.llvm.org/D83849

Added: 
    

Modified: 
    llvm/utils/TableGen/CodeGenDAGPatterns.h

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/CodeGenDAGPatterns.h b/llvm/utils/TableGen/CodeGenDAGPatterns.h
index a3b84d76fde9..5d8d6d346cd2 100644
--- a/llvm/utils/TableGen/CodeGenDAGPatterns.h
+++ b/llvm/utils/TableGen/CodeGenDAGPatterns.h
@@ -190,7 +190,7 @@ struct MachineValueTypeSet {
 
 struct TypeSetByHwMode : public InfoByHwMode<MachineValueTypeSet> {
   using SetType = MachineValueTypeSet;
-  std::vector<unsigned> AddrSpaces;
+  SmallVector<unsigned, 16> AddrSpaces;
 
   TypeSetByHwMode() = default;
   TypeSetByHwMode(const TypeSetByHwMode &VTS) = default;


        


More information about the llvm-commits mailing list