From da823382d29d7bf600079a3b4e41736e60c72918 Mon Sep 17 00:00:00 2001 From: Alexander Shaposhnikov Date: Wed, 11 May 2022 01:07:54 +0000 Subject: [PATCH] [Transform][Utils][NFC] Clean up CtorUtils.cpp --- llvm/lib/Transforms/Utils/CtorUtils.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/Utils/CtorUtils.cpp b/llvm/lib/Transforms/Utils/CtorUtils.cpp index f8afcbd..5f709f3 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; } -- 2.7.4