[llvm] dcad676 - [CGSCC] Use make_early_inc_range. NFC

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 23 15:31:13 PDT 2022


Author: Fangrui Song
Date: 2022-03-23T15:31:09-07:00
New Revision: dcad676958e7b8345784e4b19c45d6bada9a3836

URL: https://github.com/llvm/llvm-project/commit/dcad676958e7b8345784e4b19c45d6bada9a3836
DIFF: https://github.com/llvm/llvm-project/commit/dcad676958e7b8345784e4b19c45d6bada9a3836.diff

LOG: [CGSCC] Use make_early_inc_range. NFC

Added: 
    

Modified: 
    llvm/lib/Analysis/CGSCCPassManager.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/CGSCCPassManager.cpp b/llvm/lib/Analysis/CGSCCPassManager.cpp
index 02210310188c1..b2e7422bbf8bf 100644
--- a/llvm/lib/Analysis/CGSCCPassManager.cpp
+++ b/llvm/lib/Analysis/CGSCCPassManager.cpp
@@ -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();


        


More information about the llvm-commits mailing list