[llvm] [BOLT][NFC] Use const reference in range-based for loop (PR #92932)

Heewon Cho via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 11:26:06 PDT 2024


https://github.com/Pribess updated https://github.com/llvm/llvm-project/pull/92932

>From 2e4c60b961ac8c53ad5dcb9e1546ecde99df4d92 Mon Sep 17 00:00:00 2001
From: Heewon Cho <heewon6752 at gmail.com>
Date: Tue, 21 May 2024 21:52:25 +0900
Subject: [PATCH] [BOLT][NFC] Use const reference in range-based for loop

---
 bolt/include/bolt/Passes/StokeInfo.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bolt/include/bolt/Passes/StokeInfo.h b/bolt/include/bolt/Passes/StokeInfo.h
index 76417e6a2c3ba..a18c2a05d0153 100644
--- a/bolt/include/bolt/Passes/StokeInfo.h
+++ b/bolt/include/bolt/Passes/StokeInfo.h
@@ -87,10 +87,10 @@ struct StokeFuncInfo {
               << "," << NumBlocks << "," << IsLoopFree << "," << NumLoops << ","
               << MaxLoopDepth << "," << HotSize << "," << TotalSize << ","
               << Score << "," << HasCall << ",\"{ ";
-      for (std::string S : DefIn)
+      for (const std::string &S : DefIn)
         Outfile << "%" << S << " ";
       Outfile << "}\",\"{ ";
-      for (std::string S : LiveOut)
+      for (const std::string &S : LiveOut)
         Outfile << "%" << S << " ";
       Outfile << "}\"," << HeapOut << "," << StackOut << "," << HasRipAddr
               << "," << Omitted << "\n";



More information about the llvm-commits mailing list