[llvm] 4736e57 - [IndVars] Use phis() (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 25 03:08:19 PST 2022


Author: Nikita Popov
Date: 2022-02-25T12:08:12+01:00
New Revision: 4736e57199fabdf72888c39854b8bb9cfdbf1cb7

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

LOG: [IndVars] Use phis() (NFC)

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
index ceb03eb17f6d1..552ea1a5fb5e5 100644
--- a/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
+++ b/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
@@ -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


        


More information about the llvm-commits mailing list