[llvm] bbebb56 - [TableGen] X86EVEX2VEXTablesEmitter - Use const-ref iterator in for-range loop. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 17 06:09:57 PDT 2021


Author: Simon Pilgrim
Date: 2021-09-17T14:04:53+01:00
New Revision: bbebb564f9316fd37605eb92028d15f9e005d212

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

LOG: [TableGen] X86EVEX2VEXTablesEmitter - Use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

Added: 
    

Modified: 
    llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp b/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp
index 009dc036cf97..36c71843d70e 100644
--- a/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp
+++ b/llvm/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp
@@ -65,7 +65,7 @@ void X86EVEX2VEXTablesEmitter::printTable(const std::vector<Entry> &Table,
      << "  // EVEX scalar with corresponding VEX.\n";
 
   // Print all entries added to the table
-  for (auto Pair : Table) {
+  for (const auto &Pair : Table) {
     OS << "  { X86::" << Pair.first->TheDef->getName()
        << ", X86::" << Pair.second->TheDef->getName() << " },\n";
   }
@@ -80,7 +80,7 @@ void X86EVEX2VEXTablesEmitter::printCheckPredicate(
      << "  unsigned Opc = MI.getOpcode();\n"
      << "  switch (Opc) {\n"
      << "    default: return true;\n";
-  for (auto Pair : Predicates)
+  for (const auto &Pair : Predicates)
     OS << "    case X86::" << Pair.first << ": return " << Pair.second << ";\n";
   OS << "  }\n"
      << "}\n\n";


        


More information about the llvm-commits mailing list