[llvm] r229319 - [ADCE] Convert another loop for a range-based for

Hal Finkel hfinkel at anl.gov
Sun Feb 15 07:51:25 PST 2015


Author: hfinkel
Date: Sun Feb 15 09:51:25 2015
New Revision: 229319

URL: http://llvm.org/viewvc/llvm-project?rev=229319&view=rev
Log:
[ADCE] Convert another loop for a range-based for

We can use a range-based for for the operands loop too; NFC.

Modified:
    llvm/trunk/lib/Transforms/Scalar/ADCE.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/ADCE.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/ADCE.cpp?rev=229319&r1=229318&r2=229319&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/ADCE.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/ADCE.cpp Sun Feb 15 09:51:25 2015
@@ -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





More information about the llvm-commits mailing list