Revert "[llvm] Use range-based for loops (NFC)"
authorVitaly Buka <vitalybuka@google.com>
Sun, 4 Sep 2022 21:52:04 +0000 (14:52 -0700)
committerVitaly Buka <vitalybuka@google.com>
Sun, 4 Sep 2022 22:28:53 +0000 (15:28 -0700)
range-based loop should not be used here, as
fixupImmediateBr push_backs into the container.

http://lab.llvm.org/buildbot/#/builders/168
http://lab.llvm.org/buildbot/#/builders/74
http://lab.llvm.org/buildbot/#/builders/5
http://lab.llvm.org/buildbot/#/builders/239
http://lab.llvm.org/buildbot/#/builders/237
http://lab.llvm.org/buildbot/#/builders/236

This reverts commit fedc59734a44ef7b62c5f389b0cdffd02264b2a9.

llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
llvm/lib/Target/Mips/MipsConstantIslandPass.cpp

index 24a5f02..386a748 100644 (file)
@@ -480,8 +480,8 @@ bool ARMConstantIslands::runOnMachineFunction(MachineFunction &mf) {
 
     LLVM_DEBUG(dbgs() << "Beginning BR iteration #" << NoBRIters << '\n');
     bool BRChange = false;
-    for (ImmBranch &IB : ImmBranches)
-      BRChange |= fixupImmediateBr(IB);
+    for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i)
+      BRChange |= fixupImmediateBr(ImmBranches[i]);
     if (BRChange && ++NoBRIters > 30)
       report_fatal_error("Branch Fix Up pass failed to converge!");
     LLVM_DEBUG(dumpBBs());
index 25a0b05..0341af0 100644 (file)
@@ -500,8 +500,8 @@ bool MipsConstantIslands::runOnMachineFunction(MachineFunction &mf) {
 
     LLVM_DEBUG(dbgs() << "Beginning BR iteration #" << NoBRIters << '\n');
     bool BRChange = false;
-    for (ImmBranch &IB : ImmBranches)
-      BRChange |= fixupImmediateBr(IB);
+    for (unsigned i = 0, e = ImmBranches.size(); i != e; ++i)
+      BRChange |= fixupImmediateBr(ImmBranches[i]);
     if (BRChange && ++NoBRIters > 30)
       report_fatal_error("Branch Fix Up pass failed to converge!");
     LLVM_DEBUG(dumpBBs());