Revision: 126860
Author:   clattner
Date:     2007-05-03 17:52:00 -0700 (Thu, 03 May 2007)

Log Message:
-----------
Fix C++Frontend/2007-05-03-VectorInit.cpp and PR1378.  It isn't 
clear whether a VECTOR_CST with no elements is supposed to be undef
or zero.  Default to zero for now.

Modified Paths:
--------------
    apple-local/branches/llvm/gcc/llvm-convert.cpp

Modified: apple-local/branches/llvm/gcc/llvm-convert.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-convert.cpp      2007-05-04 00:48:51 UTC 
(rev 126859)
+++ apple-local/branches/llvm/gcc/llvm-convert.cpp      2007-05-04 00:52:00 UTC 
(rev 126860)
@@ -5189,11 +5189,14 @@
 }
 
 Constant *TreeConstantToLLVM::ConvertVECTOR_CST(tree exp) {
-  std::vector<Constant*> Elts;
-
-  for (tree elt = TREE_VECTOR_CST_ELTS(exp); elt; elt = TREE_CHAIN(elt))
-    Elts.push_back(Convert(TREE_VALUE(elt)));
-  return ConstantVector::get(Elts);
+  if (TREE_VECTOR_CST_ELTS(exp)) {
+    std::vector<Constant*> Elts;
+    for (tree elt = TREE_VECTOR_CST_ELTS(exp); elt; elt = TREE_CHAIN(elt))
+      Elts.push_back(Convert(TREE_VALUE(elt)));
+    return ConstantVector::get(Elts);
+  } else {
+    return Constant::getNullValue(ConvertType(TREE_TYPE(exp)));
+  }
 }
 
 Constant *TreeConstantToLLVM::ConvertSTRING_CST(tree exp) {


_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

Reply via email to