diff options
author | Kazu Hirata <kazu@google.com> | 2024-09-04 01:29:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 01:29:13 -0700 |
commit | e99eb89d5d97efc709f18f9369f2ec087352baaa (patch) | |
tree | 8a441bf8c0a9a48b4a073f9fcb8e9360874cc511 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | 8bfd6b953fc119bbc37c1755e701261fcfb31ad2 (diff) | |
download | llvm-e99eb89d5d97efc709f18f9369f2ec087352baaa.zip llvm-e99eb89d5d97efc709f18f9369f2ec087352baaa.tar.gz llvm-e99eb89d5d97efc709f18f9369f2ec087352baaa.tar.bz2 |
[SimplifyCFG] Use range-based for loops (NFC) (#107180)
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 15de40c7..f9db996 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1000,20 +1000,20 @@ bool SimplifyCFGOpt::simplifyEqualityComparisonWithOnlyPredecessor( // which value (or set of values) this is. ConstantInt *TIV = nullptr; BasicBlock *TIBB = TI->getParent(); - for (unsigned i = 0, e = PredCases.size(); i != e; ++i) - if (PredCases[i].Dest == TIBB) { + for (const auto &[Value, Dest] : PredCases) + if (Dest == TIBB) { if (TIV) return false; // Cannot handle multiple values coming to this block. - TIV = PredCases[i].Value; + TIV = Value; } assert(TIV && "No edge from pred to succ?"); // Okay, we found the one constant that our value can be if we get into TI's // BB. Find out which successor will unconditionally be branched to. BasicBlock *TheRealDest = nullptr; - for (unsigned i = 0, e = ThisCases.size(); i != e; ++i) - if (ThisCases[i].Value == TIV) { - TheRealDest = ThisCases[i].Dest; + for (const auto &[Value, Dest] : ThisCases) + if (Value == TIV) { + TheRealDest = Dest; break; } |