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

via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 09:44:17 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-bolt

Author: Heewon Cho (Pribess)

<details>
<summary>Changes</summary>

Addressing #<!-- -->91195 

---
Full diff: https://github.com/llvm/llvm-project/pull/92931.diff


1 Files Affected:

- (modified) bolt/include/bolt/Passes/StokeInfo.h (+2-2) 


``````````diff
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";

``````````

</details>


https://github.com/llvm/llvm-project/pull/92931


More information about the llvm-commits mailing list