[llvm] [GenericDomTree] Use range-based for loops (NFC) (PR #96404)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Sat Jun 22 13:39:18 PDT 2024
================
@@ -882,9 +879,9 @@ class DominatorTreeBase {
// changed.
if (!NewBBIDom) return;
- for (i = i + 1; i < PredBlocks.size(); ++i) {
- if (isReachableFromEntry(PredBlocks[i]))
- NewBBIDom = findNearestCommonDominator(NewBBIDom, PredBlocks[i]);
+ for (const auto &Pred : llvm::drop_begin(PredBlocks)) {
----------------
nikic wrote:
That's not right -- this loop is supposed to pick up where the last one stopped, not skip just the first element.
The code is still correct because the NCD operation is idempotent, but it makes the code less efficient.
https://github.com/llvm/llvm-project/pull/96404
More information about the llvm-commits
mailing list