Index: llvm/lib/Analysis/CFG.cpp =================================================================== --- llvm/lib/Analysis/CFG.cpp +++ llvm/lib/Analysis/CFG.cpp @@ -165,13 +165,13 @@ // The dominance check effectively visits all blocks dominated by BB. Skip // over the domtree-descendants of the block to visit their successors. - for (auto I = df_begin(DTN), E = df_end(DTN); I != E; ++I) { - for (auto Succ : successors(I->getBlock())) { + DT.forEachDescendant(DTN, [&](DomTreeNode *Dominated) { + for (auto Succ : successors(Dominated->getBlock())) { DomTreeNode *DTSucc = DT.getNode(Succ); if (!DT.dominates(DTN, DTSucc)) Worklist.push_back(DTSucc); } - } + }); } while (!Worklist.empty()); // We have exhausted all possible paths and are certain that 'To' can not be