transform more loops to iterator form, detabify
authorGabor Greif <ggreif@gmail.com>
Thu, 22 May 2008 19:24:54 +0000 (19:24 +0000)
committerGabor Greif <ggreif@gmail.com>
Thu, 22 May 2008 19:24:54 +0000 (19:24 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51436 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/ConstantFolding.cpp
lib/Analysis/LoadValueNumbering.cpp

index e260d24ec895e2905376f0a2fdf66ea8d563b917..d933dd8d4033d807d2ac6e837777f69131541cdd 100644 (file)
@@ -66,7 +66,7 @@ static bool IsConstantOffsetFromGlobal(Constant *C, GlobalValue *&GV,
     // Otherwise, add any offset that our operands provide.
     gep_type_iterator GTI = gep_type_begin(CE);
     for (User::const_op_iterator i = CE->op_begin() + 1, e = CE->op_end();
-        i != e; ++i, ++GTI) {
+         i != e; ++i, ++GTI) {
       ConstantInt *CI = dyn_cast<ConstantInt>(*i);
       if (!CI) return false;  // Index isn't a simple constant?
       if (CI->getZExtValue() == 0) continue;  // Not adding anything.
index 0317ddbc914042487363137ee04e0067b9c9697a..2414d33863dd1d303c5cf28fb6bed3f2d64b2bff 100644 (file)
@@ -158,10 +158,10 @@ void LoadVN::getCallEqualNumberNodes(CallInst *CI,
   // global.  In particular, we would prefer to have an argument or instruction
   // operand to chase the def-use chains of.
   Value *Op = CF;
-  for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i)
-    if (isa<Argument>(CI->getOperand(i)) ||
-        isa<Instruction>(CI->getOperand(i))) {
-      Op = CI->getOperand(i);
+  for (User::op_iterator i = CI->op_begin() + 1, e = CI->op_end(); i != e; ++i)
+    if (isa<Argument>(*i) ||
+        isa<Instruction>(*i)) {
+      Op = *i;
       break;
     }
 
@@ -176,8 +176,9 @@ void LoadVN::getCallEqualNumberNodes(CallInst *CI,
           C->getOperand(0) == CI->getOperand(0) &&
           C->getParent()->getParent() == CIFunc && C != CI) {
         bool AllOperandsEqual = true;
-        for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i)
-          if (C->getOperand(i) != CI->getOperand(i)) {
+        for (User::op_iterator i = CI->op_begin() + 1, j = C->op_begin() + 1,
+             e = CI->op_end(); i != e; ++i, ++j)
+          if (*j != *i) {
             AllOperandsEqual = false;
             break;
           }