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

Eli Friedman eli.friedman at gmail.com
Sat Jan 2 15:43:59 PST 2010


Author: efriedma
Date: Sat Jan  2 17:43:59 2010
New Revision: 92432

URL: http://llvm.org/viewvc/llvm-project?rev=92432&view=rev
Log:
Get rid of some unnecessary code.


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=92432&r1=92431&r2=92432&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprConstant.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprConstant.cpp Sat Jan  2 17:43:59 2010
@@ -633,32 +633,6 @@
     return ConstStructBuilder::BuildStruct(CGM, CGF, ILE);
   }
 
-  llvm::Constant *EmitVectorInitialization(InitListExpr *ILE) {
-    const llvm::VectorType *VType =
-        cast<llvm::VectorType>(ConvertType(ILE->getType()));
-    const llvm::Type *ElemTy = VType->getElementType();
-    std::vector<llvm::Constant*> Elts;
-    unsigned NumElements = VType->getNumElements();
-    unsigned NumInitElements = ILE->getNumInits();
-
-    unsigned NumInitableElts = std::min(NumInitElements, NumElements);
-
-    // Copy initializer elements.
-    unsigned i = 0;
-    for (; i < NumInitableElts; ++i) {
-      Expr *Init = ILE->getInit(i);
-      llvm::Constant *C = CGM.EmitConstantExpr(Init, Init->getType(), CGF);
-      if (!C)
-        return 0;
-      Elts.push_back(C);
-    }
-
-    for (; i < NumElements; ++i)
-      Elts.push_back(llvm::Constant::getNullValue(ElemTy));
-
-    return llvm::ConstantVector::get(VType, Elts);
-  }
-
   llvm::Constant *VisitImplicitValueInitExpr(ImplicitValueInitExpr* E) {
     return CGM.EmitNullConstant(E->getType());
   }
@@ -682,8 +656,9 @@
     if (ILE->getType()->isUnionType())
       return EmitUnionInitialization(ILE);
 
+    // If ILE was a constant vector, we would have handled it already.
     if (ILE->getType()->isVectorType())
-      return EmitVectorInitialization(ILE);
+      return 0;
 
     assert(0 && "Unable to handle InitListExpr");
     // Get rid of control reaches end of void function warning.





More information about the cfe-commits mailing list