[llvm] [NFC][SampleFDO] Use const& to avoid copies (PR #164584)
    via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Oct 22 02:12:58 PDT 2025
    
    
  
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-pgo
Author: Abhishek Kaushik (abhishek-kaushik22)
<details>
<summary>Changes</summary>
Use const& in range-based for loop to avoid unnecessary copies
---
Full diff: https://github.com/llvm/llvm-project/pull/164584.diff
1 Files Affected:
- (modified) llvm/include/llvm/ProfileData/SampleProf.h (+1-1) 
``````````diff
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h
index 3dd34aba2d716..05f1b568b0643 100644
--- a/llvm/include/llvm/ProfileData/SampleProf.h
+++ b/llvm/include/llvm/ProfileData/SampleProf.h
@@ -1072,7 +1072,7 @@ class FunctionSamples {
     TypeCountMap &TypeCounts = getTypeSamplesAt(Loc);
     bool Overflowed = false;
 
-    for (const auto [Type, Count] : Other) {
+    for (const auto &[Type, Count] : Other) {
       FunctionId TypeId(Type);
       bool RowOverflow = false;
       TypeCounts[TypeId] = SaturatingMultiplyAdd(
``````````
</details>
https://github.com/llvm/llvm-project/pull/164584
    
    
More information about the llvm-commits
mailing list