[llvm] 4c14638 - [llvm] Use range-based for loops (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 22 00:41:44 PDT 2023
Author: Kazu Hirata
Date: 2023-09-22T00:41:37-07:00
New Revision: 4c14638b55ad0e3b2ee33adfaaa88f23f60a96c1
URL: https://github.com/llvm/llvm-project/commit/4c14638b55ad0e3b2ee33adfaaa88f23f60a96c1
DIFF: https://github.com/llvm/llvm-project/commit/4c14638b55ad0e3b2ee33adfaaa88f23f60a96c1.diff
LOG: [llvm] Use range-based for loops (NFC)
Added:
Modified:
llvm/lib/ProfileData/SampleProfWriter.cpp
llvm/lib/Transforms/Scalar/GuardWidening.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ProfileData/SampleProfWriter.cpp b/llvm/lib/ProfileData/SampleProfWriter.cpp
index f418dbe71057095..74990238d37963f 100644
--- a/llvm/lib/ProfileData/SampleProfWriter.cpp
+++ b/llvm/lib/ProfileData/SampleProfWriter.cpp
@@ -83,11 +83,9 @@ void DefaultFunctionPruningStrategy::Erase(size_t CurrentOutputSize) {
NumToRemove = 1;
assert(NumToRemove <= SortedFunctions.size());
- llvm::for_each(
- llvm::make_range(SortedFunctions.begin() + SortedFunctions.size() -
- NumToRemove,
- SortedFunctions.end()),
- [&](const NameFunctionSamples &E) { ProfileMap.erase(E.first); });
+ for (const NameFunctionSamples &E :
+ llvm::drop_begin(SortedFunctions, SortedFunctions.size() - NumToRemove))
+ ProfileMap.erase(E.first);
SortedFunctions.resize(SortedFunctions.size() - NumToRemove);
}
diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
index fb1db11e85a0b8f..d08820b632e5c1d 100644
--- a/llvm/lib/Transforms/Scalar/GuardWidening.cpp
+++ b/llvm/lib/Transforms/Scalar/GuardWidening.cpp
@@ -209,7 +209,8 @@ class GuardWideningImpl {
void makeAvailableAt(const SmallVectorImpl<Value *> &Checks,
Instruction *InsertPos) const {
- for_each(Checks, [&](Value *V) { makeAvailableAt(V, InsertPos); });
+ for (Value *V : Checks)
+ makeAvailableAt(V, InsertPos);
}
/// Common helper used by \c widenGuard and \c isWideningCondProfitable. Try
More information about the llvm-commits
mailing list