Use range for loops in PlaceSafepoints (NFC)
authorPhilip Reames <listmail@philipreames.com>
Mon, 9 Feb 2015 22:26:11 +0000 (22:26 +0000)
committerPhilip Reames <listmail@philipreames.com>
Mon, 9 Feb 2015 22:26:11 +0000 (22:26 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@228620 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/PlaceSafepoints.cpp

index 7e018db050b93bae8e030fbf165f865da81bc2c7..941d9a7dd97d6868da74eae40b563729c4a77657 100644 (file)
@@ -297,8 +297,7 @@ static void scanOneBB(Instruction *start, Instruction *end,
     // without encountering end first
     if (itr->isTerminator()) {
       BasicBlock *BB = itr->getParent();
-      for (succ_iterator PI = succ_begin(BB), E = succ_end(BB); PI != E; ++PI) {
-        BasicBlock *Succ = *PI;
+      for (BasicBlock *Succ : successors(BB)) {
         if (seen.count(Succ) == 0) {
           worklist.push_back(Succ);
           seen.insert(Succ);
@@ -336,9 +335,7 @@ bool PlaceBackedgeSafepointsImpl::runOnLoop(Loop *L, LPPassManager &LPM) {
   DT.recalculate(*header->getParent());
 
   bool modified = false;
-  for (pred_iterator PI = pred_begin(header), E = pred_end(header); PI != E;
-       PI++) {
-    BasicBlock *pred = *PI;
+  for (BasicBlock *pred : predecessors(header)) {
     if (!L->contains(pred)) {
       // This is not a backedge, it's coming from outside the loop
       continue;
@@ -470,9 +467,8 @@ static Instruction *findLocationForEntrySafepoint(Function &F,
 static void findCallSafepoints(Function &F,
                                std::vector<CallSite> &Found /*rval*/) {
   assert(Found.empty() && "must be empty!");
-  for (inst_iterator itr = inst_begin(F), end = inst_end(F); itr != end;
-       itr++) {
-    Instruction *inst = &*itr;
+  for (Instruction &I : inst_range(F)) {
+    Instruction *inst = &I;
     if (isa<CallInst>(inst) || isa<InvokeInst>(inst)) {
       CallSite CS(inst);