[ADCE] Convert another loop for a range-based for
authorHal Finkel <hfinkel@anl.gov>
Sun, 15 Feb 2015 15:51:25 +0000 (15:51 +0000)
committerHal Finkel <hfinkel@anl.gov>
Sun, 15 Feb 2015 15:51:25 +0000 (15:51 +0000)
We can use a range-based for for the operands loop too; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229319 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/ADCE.cpp

index effd87e59a899602118e6bcd3aa01aa4fc33c654..f490bb22255c2d9f177ff237f5d0f5040832d557 100644 (file)
@@ -69,11 +69,11 @@ bool ADCE::runOnFunction(Function& F) {
   // Propagate liveness backwards to operands.
   while (!Worklist.empty()) {
     Instruction *Curr = Worklist.pop_back_val();
-    for (Instruction::op_iterator OI = Curr->op_begin(), OE = Curr->op_end();
-         OI != OE; ++OI)
+    for (Use &OI : Curr->operands()) {
       if (Instruction *Inst = dyn_cast<Instruction>(OI))
         if (Alive.insert(Inst).second)
           Worklist.push_back(Inst);
+    }
   }
 
   // The inverse of the live set is the dead set.  These are those instructions