[CGSCC] Use make_early_inc_range. NFC
authorFangrui Song <i@maskray.me>
Wed, 23 Mar 2022 22:31:09 +0000 (15:31 -0700)
committerFangrui Song <i@maskray.me>
Wed, 23 Mar 2022 22:31:09 +0000 (15:31 -0700)
llvm/lib/Analysis/CGSCCPassManager.cpp

index 02210310188c1d55c06c8cec1f37613a1aa283b2..b2e7422bbf8bf178631cf927856cf7a11dc1cd7e 100644 (file)
@@ -174,9 +174,8 @@ ModuleToPostOrderCGSCCPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
 
   PreservedAnalyses PA = PreservedAnalyses::all();
   CG.buildRefSCCs();
-  for (auto RCI = CG.postorder_ref_scc_begin(),
-            RCE = CG.postorder_ref_scc_end();
-       RCI != RCE;) {
+  for (LazyCallGraph::RefSCC &RC :
+       llvm::make_early_inc_range(CG.postorder_ref_sccs())) {
     assert(RCWorklist.empty() &&
            "Should always start with an empty RefSCC worklist");
     // The postorder_ref_sccs range we are walking is lazily constructed, so
@@ -190,7 +189,7 @@ ModuleToPostOrderCGSCCPassAdaptor::run(Module &M, ModuleAnalysisManager &AM) {
     //
     // We also eagerly increment the iterator to the next position because
     // the CGSCC passes below may delete the current RefSCC.
-    RCWorklist.insert(&*RCI++);
+    RCWorklist.insert(&RC);
 
     do {
       LazyCallGraph::RefSCC *RC = RCWorklist.pop_back_val();