@@ -188,7 +188,6 @@ GenericDomTreeUpdater<DerivedT, DomTreeT, PostDomTreeT>::dump() const {
188188 return ;
189189 } else
190190 OS << " Lazy\n " ;
191- int Index = 0 ;
192191
193192 auto printBlockInfo = [&](BasicBlockT *BB, StringRef Ending) {
194193 if (BB) {
@@ -206,21 +205,19 @@ GenericDomTreeUpdater<DerivedT, DomTreeT, PostDomTreeT>::dump() const {
206205 typename ArrayRef<DomTreeUpdate>::const_iterator end) {
207206 if (begin == end)
208207 OS << " None\n " ;
209- Index = 0 ;
210- for (auto It = begin, ItEnd = end; It != ItEnd; ++It) {
211- if (!It->IsCriticalEdgeSplit ) {
212- auto U = It->Update ;
208+ for (auto [Index, DTUpdate] : enumerate(make_range (begin, end))) {
209+ if (!DTUpdate.IsCriticalEdgeSplit ) {
210+ auto U = DTUpdate.Update ;
213211 OS << " " << Index << " : " ;
214- ++Index;
215212 if (U.getKind () == DomTreeT::Insert)
216213 OS << " Insert, " ;
217214 else
218215 OS << " Delete, " ;
219216 printBlockInfo (U.getFrom (), " , " );
220217 printBlockInfo (U.getTo (), " \n " );
221218 } else {
222- const auto &Edge = It-> EdgeSplit ;
223- OS << " " << Index++ << " : Split critical edge, " ;
219+ const auto &Edge = DTUpdate. EdgeSplit ;
220+ OS << " " << Index << " : Split critical edge, " ;
224221 printBlockInfo (Edge.FromBB , " , " );
225222 printBlockInfo (Edge.ToBB , " , " );
226223 printBlockInfo (Edge.NewBB , " \n " );
@@ -249,10 +246,8 @@ GenericDomTreeUpdater<DerivedT, DomTreeT, PostDomTreeT>::dump() const {
249246 }
250247
251248 OS << " Pending DeletedBBs:\n " ;
252- Index = 0 ;
253- for (const auto *BB : DeletedBBs) {
249+ for (auto [Index, BB] : enumerate(DeletedBBs)) {
254250 OS << " " << Index << " : " ;
255- ++Index;
256251 if (BB->hasName ())
257252 OS << BB->getName () << " (" ;
258253 else
@@ -463,7 +458,7 @@ void GenericDomTreeUpdater<DerivedT, DomTreeT, PostDomTreeT>::
463458 if (NewBBs.count (SuccBB)) {
464459 assert (succ_size (SuccBB) == 1 && " A basic block resulting from a "
465460 " critical edge split has more "
466- " than one predecessor !" );
461+ " than one successor !" );
467462 SuccBB = *succ_begin (SuccBB);
468463 }
469464 if (!PDT->dominates (PredDTNode, PDT->getNode (SuccBB))) {
0 commit comments