convert another operand loop to iterator formulation
authorGabor Greif <ggreif@gmail.com>
Thu, 29 May 2008 00:51:08 +0000 (00:51 +0000)
committerGabor Greif <ggreif@gmail.com>
Thu, 29 May 2008 00:51:08 +0000 (00:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51661 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ValueNumbering.cpp

index 1e4b306f62ec049fa9d3428030751671ca4c932e..98f04bd06e15c485b74bbaa19b1d079b349f4686 100644 (file)
@@ -244,9 +244,9 @@ void BVNImpl::visitGetElementPtrInst(GetElementPtrInst &I) {
 
   // Try to pick a local operand if possible instead of a constant or a global
   // that might have a lot of uses.
-  for (unsigned i = 1, e = I.getNumOperands(); i != e; ++i)
-    if (isa<Instruction>(I.getOperand(i)) || isa<Argument>(I.getOperand(i))) {
-      Op = I.getOperand(i);
+  for (User::op_iterator i = I.op_begin() + 1, e = I.op_end(); i != e; ++i)
+    if (isa<Instruction>(*i) || isa<Argument>(*i)) {
+      Op = *i;
       break;
     }