[Transform][Utils][NFC] Clean up CtorUtils.cpp
authorAlexander Shaposhnikov <ashaposhnikov@google.com>
Wed, 11 May 2022 01:07:54 +0000 (01:07 +0000)
committerAlexander Shaposhnikov <ashaposhnikov@google.com>
Wed, 11 May 2022 01:07:54 +0000 (01:07 +0000)
llvm/lib/Transforms/Utils/CtorUtils.cpp

index f8afcbd..5f709f3 100644 (file)
@@ -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;
     }