[llvm] ea17b15 - [MCA] InstructionTables::execute() - use const-ref iterator in for-range loop. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 20 04:54:03 PDT 2021


Author: Simon Pilgrim
Date: 2021-09-20T12:53:17+01:00
New Revision: ea17b15f2dcdc77881cc0183dce4dea1aff9bffa

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

LOG: [MCA] InstructionTables::execute() - use const-ref iterator in for-range loop. NFCI.

Avoid unnecessary copies, reported by MSVC static analyzer.

Added: 
    

Modified: 
    llvm/lib/MCA/Stages/InstructionTables.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MCA/Stages/InstructionTables.cpp b/llvm/lib/MCA/Stages/InstructionTables.cpp
index 93e368123066..fcd7e91ed997 100644
--- a/llvm/lib/MCA/Stages/InstructionTables.cpp
+++ b/llvm/lib/MCA/Stages/InstructionTables.cpp
@@ -24,7 +24,7 @@ Error InstructionTables::execute(InstRef &IR) {
   UsedResources.clear();
 
   // Identify the resources consumed by this instruction.
-  for (const std::pair<const uint64_t, ResourceUsage> Resource :
+  for (const std::pair<const uint64_t, ResourceUsage> &Resource :
        Desc.Resources) {
     // Skip zero-cycle resources (i.e., unused resources).
     if (!Resource.second.size())


        


More information about the llvm-commits mailing list