[cfe-commits] r149933 - /cfe/trunk/lib/CodeGen/CGExprConstant.cpp

Bill Wendling isanbard at gmail.com
Mon Feb 6 15:46:08 PST 2012


Author: void
Date: Mon Feb  6 17:46:08 2012
New Revision: 149933

URL: http://llvm.org/viewvc/llvm-project?rev=149933&view=rev
Log:
Don't recalculate the size of the array each time through the for-loop.

Modified:
    cfe/trunk/lib/CodeGen/CGExprConstant.cpp

Modified: cfe/trunk/lib/CodeGen/CGExprConstant.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprConstant.cpp?rev=149933&r1=149932&r2=149933&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Mon Feb  6 17:46:08 2012
@@ -727,7 +727,7 @@
     if (RewriteType) {
       // FIXME: Try to avoid packing the array
       std::vector<llvm::Type*> Types;
-      for (unsigned i = 0; i < Elts.size(); ++i)
+      for (unsigned i = 0, e = Elts.size(); i < e; ++i)
         Types.push_back(Elts[i]->getType());
       llvm::StructType *SType = llvm::StructType::get(AType->getContext(),
                                                             Types, true);
@@ -1132,7 +1132,7 @@
     if (!CommonElementType) {
       // FIXME: Try to avoid packing the array
       std::vector<llvm::Type*> Types;
-      for (unsigned i = 0; i < Elts.size(); ++i)
+      for (unsigned i = 0, e = Elts.size(); i < e; ++i)
         Types.push_back(Elts[i]->getType());
       llvm::StructType *SType = llvm::StructType::get(VMContext, Types, true);
       return llvm::ConstantStruct::get(SType, Elts);





More information about the cfe-commits mailing list