[llvm] a9cc7fe - [NFC][SampleFDO] Use const& to avoid copies (#164584)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 26 22:52:33 PST 2025
Author: Abhishek Kaushik
Date: 2025-11-27T12:22:29+05:30
New Revision: a9cc7fe3caf6e14ae755689df8ccde2edc4c8a43
URL: https://github.com/llvm/llvm-project/commit/a9cc7fe3caf6e14ae755689df8ccde2edc4c8a43
DIFF: https://github.com/llvm/llvm-project/commit/a9cc7fe3caf6e14ae755689df8ccde2edc4c8a43.diff
LOG: [NFC][SampleFDO] Use const& to avoid copies (#164584)
Use const& in range-based for loop to avoid unnecessary copies
Added:
Modified:
llvm/include/llvm/ProfileData/SampleProf.h
Removed:
################################################################################
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(
More information about the llvm-commits
mailing list