[llvm-commits] [llvm] r51436 - in /llvm/trunk/lib/Analysis: ConstantFolding.cpp LoadValueNumbering.cpp
Gabor Greif
ggreif at gmail.com
Thu May 22 12:24:54 PDT 2008
Author: ggreif
Date: Thu May 22 14:24:54 2008
New Revision: 51436
URL: http://llvm.org/viewvc/llvm-project?rev=51436&view=rev
Log:
transform more loops to iterator form, detabify
Modified:
llvm/trunk/lib/Analysis/ConstantFolding.cpp
llvm/trunk/lib/Analysis/LoadValueNumbering.cpp
Modified: llvm/trunk/lib/Analysis/ConstantFolding.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ConstantFolding.cpp?rev=51436&r1=51435&r2=51436&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ConstantFolding.cpp (original)
+++ llvm/trunk/lib/Analysis/ConstantFolding.cpp Thu May 22 14:24:54 2008
@@ -66,7 +66,7 @@
// 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.
Modified: llvm/trunk/lib/Analysis/LoadValueNumbering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoadValueNumbering.cpp?rev=51436&r1=51435&r2=51436&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoadValueNumbering.cpp (original)
+++ llvm/trunk/lib/Analysis/LoadValueNumbering.cpp Thu May 22 14:24:54 2008
@@ -158,10 +158,10 @@
// 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 @@
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;
}
More information about the llvm-commits
mailing list