[llvm-commits] CVS: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp

Chris Lattner sabre at nondot.org
Fri Jan 12 14:51:35 PST 2007



Changes in directory llvm/lib/Transforms/Scalar:

IndVarSimplify.cpp updated: 1.103 -> 1.104
---
Log message:

simplify some code


---
Diffs of the changes:  (+2 -8)

 IndVarSimplify.cpp |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)


Index: llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
diff -u llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.103 llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.104
--- llvm/lib/Transforms/Scalar/IndVarSimplify.cpp:1.103	Fri Jan 12 01:05:14 2007
+++ llvm/lib/Transforms/Scalar/IndVarSimplify.cpp	Fri Jan 12 16:51:20 2007
@@ -533,14 +533,8 @@
     InsertedSizes.push_back(LargestType->getPrimitiveSizeInBits());
     for (unsigned i = 0, e = IndVars.size(); i != e; ++i) {
       unsigned ithSize = IndVars[i].first->getType()->getPrimitiveSizeInBits();
-      bool alreadyInsertedSize = false;
-      for (SmallVector<unsigned,4>::iterator I = InsertedSizes.begin(), 
-           E = InsertedSizes.end(); I != E; ++I)
-        if (*I == ithSize) {
-          alreadyInsertedSize = true;
-          break;
-        }
-      if (!alreadyInsertedSize) {
+      if (std::find(InsertedSizes.begin(), InsertedSizes.end(), ithSize)
+          == InsertedSizes.end()) {
         PHINode *PN = IndVars[i].first;
         InsertedSizes.push_back(ithSize);
         Instruction *New = new TruncInst(IndVar, PN->getType(), "indvar",






More information about the llvm-commits mailing list