[LLVM] Use range based for loop, NFC
authorJun Zhang <jun@junz.org>
Tue, 9 Aug 2022 15:59:05 +0000 (23:59 +0800)
committerJun Zhang <jun@junz.org>
Tue, 9 Aug 2022 16:04:26 +0000 (00:04 +0800)
Signed-off-by: Jun Zhang <jun@junz.org>
llvm/include/llvm/IR/PassManager.h

index a001e38..fa6be6a 100644 (file)
@@ -507,24 +507,22 @@ public:
         detail::getAnalysisResult<PassInstrumentationAnalysis>(
             AM, IR, std::tuple<ExtraArgTs...>(ExtraArgs...));
 
-    for (unsigned Idx = 0, Size = Passes.size(); Idx != Size; ++Idx) {
-      auto *P = Passes[Idx].get();
-
+    for (auto &Pass : Passes) {
       // Check the PassInstrumentation's BeforePass callbacks before running the
       // pass, skip its execution completely if asked to (callback returns
       // false).
-      if (!PI.runBeforePass<IRUnitT>(*P, IR))
+      if (!PI.runBeforePass<IRUnitT>(*Pass, IR))
         continue;
 
       PreservedAnalyses PassPA;
       {
-        TimeTraceScope TimeScope(P->name(), IR.getName());
-        PassPA = P->run(IR, AM, ExtraArgs...);
+        TimeTraceScope TimeScope(Pass->name(), IR.getName());
+        PassPA = Pass->run(IR, AM, ExtraArgs...);
       }
 
       // Call onto PassInstrumentation's AfterPass callbacks immediately after
       // running the pass.
-      PI.runAfterPass<IRUnitT>(*P, IR, PassPA);
+      PI.runAfterPass<IRUnitT>(*Pass, IR, PassPA);
 
       // Update the analysis manager as each pass runs and potentially
       // invalidates analyses.