[llvm] 6c52736 - Revert "[llvm] Use range-based for loops (NFC)"

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 4 15:29:07 PDT 2022


Author: Vitaly Buka
Date: 2022-09-04T15:28:53-07:00
New Revision: 6c52736e024588ab3020d4890ead495252b85290

URL: https://github.com/llvm/llvm-project/commit/6c52736e024588ab3020d4890ead495252b85290
DIFF: https://github.com/llvm/llvm-project/commit/6c52736e024588ab3020d4890ead495252b85290.diff

LOG: Revert "[llvm] Use range-based for loops (NFC)"

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.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
index 24a5f02e53c3..386a74877bc1 100644
--- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
+++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp
@@ -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());

diff  --git a/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp b/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
index 25a0b052cd96..0341af0caac4 100644
--- a/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
+++ b/llvm/lib/Target/Mips/MipsConstantIslandPass.cpp
@@ -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());


        


More information about the llvm-commits mailing list