[llvm] 53f1748 - ProfileSummary.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 21 08:55:59 PDT 2020


Author: Simon Pilgrim
Date: 2020-09-21T16:54:26+01:00
New Revision: 53f1748c131c8d7ff0bb5e5c77132780c5d1fbc7

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

LOG: ProfileSummary.cpp - use auto const& iterator in for-range loop to avoid copies. NFCI.

Added: 
    

Modified: 
    llvm/lib/IR/ProfileSummary.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/IR/ProfileSummary.cpp b/llvm/lib/IR/ProfileSummary.cpp
index ac6bcd9fe3af..453a278a7f3f 100644
--- a/llvm/lib/IR/ProfileSummary.cpp
+++ b/llvm/lib/IR/ProfileSummary.cpp
@@ -259,7 +259,7 @@ void ProfileSummary::printSummary(raw_ostream &OS) {
 
 void ProfileSummary::printDetailedSummary(raw_ostream &OS) {
   OS << "Detailed summary:\n";
-  for (auto Entry : DetailedSummary) {
+  for (const auto &Entry : DetailedSummary) {
     OS << Entry.NumCounts << " blocks with count >= " << Entry.MinCount
        << " account for "
        << format("%0.6g", (float)Entry.Cutoff / Scale * 100)


        


More information about the llvm-commits mailing list