[llvm] da82338 - [Transform][Utils][NFC] Clean up CtorUtils.cpp
Alexander Shaposhnikov via llvm-commits
llvm-commits at lists.llvm.org
Tue May 10 18:17:05 PDT 2022
Author: Alexander Shaposhnikov
Date: 2022-05-11T01:07:54Z
New Revision: da823382d29d7bf600079a3b4e41736e60c72918
URL: https://github.com/llvm/llvm-project/commit/da823382d29d7bf600079a3b4e41736e60c72918
DIFF: https://github.com/llvm/llvm-project/commit/da823382d29d7bf600079a3b4e41736e60c72918.diff
LOG: [Transform][Utils][NFC] Clean up CtorUtils.cpp
Added:
Modified:
llvm/lib/Transforms/Utils/CtorUtils.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Utils/CtorUtils.cpp b/llvm/lib/Transforms/Utils/CtorUtils.cpp
index f8afcbd40b3f..5f709f3911a1 100644
--- a/llvm/lib/Transforms/Utils/CtorUtils.cpp
+++ b/llvm/lib/Transforms/Utils/CtorUtils.cpp
@@ -127,9 +127,8 @@ bool llvm::optimizeGlobalCtorsList(
bool MadeChange = false;
// Loop over global ctors, optimizing them when we can.
- unsigned NumCtors = Ctors.size();
- BitVector CtorsToRemove(NumCtors);
- for (unsigned i = 0; i != Ctors.size() && NumCtors > 0; ++i) {
+ BitVector CtorsToRemove(Ctors.size());
+ for (unsigned i = 0, e = Ctors.size(); i != e; ++i) {
Function *F = Ctors[i];
// Found a null terminator in the middle of the list, prune off the rest of
// the list.
@@ -146,7 +145,6 @@ bool llvm::optimizeGlobalCtorsList(
if (ShouldRemove(F)) {
Ctors[i] = nullptr;
CtorsToRemove.set(i);
- NumCtors--;
MadeChange = true;
continue;
}
More information about the llvm-commits
mailing list