[IndVars] Use phis() (NFC)
authorNikita Popov <npopov@redhat.com>
Fri, 25 Feb 2022 11:07:49 +0000 (12:07 +0100)
committerNikita Popov <npopov@redhat.com>
Fri, 25 Feb 2022 11:08:12 +0000 (12:08 +0100)
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

index ceb03eb..552ea1a 100644 (file)
@@ -605,10 +605,10 @@ bool IndVarSimplify::simplifyAndExtend(Loop *L,
           Intrinsic::getName(Intrinsic::experimental_guard));
   bool HasGuards = GuardDecl && !GuardDecl->use_empty();
 
-  SmallVector<PHINode*, 8> LoopPhis;
-  for (BasicBlock::iterator I = L->getHeader()->begin(); isa<PHINode>(I); ++I) {
-    LoopPhis.push_back(cast<PHINode>(I));
-  }
+  SmallVector<PHINode *, 8> LoopPhis;
+  for (PHINode &PN : L->getHeader()->phis())
+    LoopPhis.push_back(&PN);
+
   // Each round of simplification iterates through the SimplifyIVUsers worklist
   // for all current phis, then determines whether any IVs can be
   // widened. Widening adds new phis to LoopPhis, inducing another round of