simplify some code
authorChris Lattner <sabre@nondot.org>
Fri, 12 Jan 2007 22:51:20 +0000 (22:51 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 12 Jan 2007 22:51:20 +0000 (22:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33150 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/IndVarSimplify.cpp

index 0643e75ab34beacd87d94dbefd13f909d441beff..5ef886e956c2084059c240a445c6ae7315e951fe 100644 (file)
@@ -533,14 +533,8 @@ void IndVarSimplify::runOnLoop(Loop *L) {
     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",