[llvm-commits] [llvm-gcc-4.2] r53338 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Dale Johannesen dalej at apple.com
Wed Jul 9 11:24:48 PDT 2008


Author: johannes
Date: Wed Jul  9 13:24:45 2008
New Revision: 53338

URL: http://llvm.org/viewvc/llvm-project?rev=53338&view=rev
Log:
Revert 50317, which fixes PR 2533.  This does not
cause any regressions in the compat or struct-layout-1
parts of the gcc testsuite on darwin x86-(32|64).


Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=53338&r1=53337&r2=53338&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Wed Jul  9 13:24:45 2008
@@ -6619,7 +6619,6 @@
 
 Constant *TreeConstantToLLVM::ConvertRecordCONSTRUCTOR(tree exp) {
   const StructType *STy = cast<StructType>(ConvertType(TREE_TYPE(exp)));
-  bool OneEltIsUnion = false;
   std::vector<Constant*> ResultElts;
   ResultElts.resize(STy->getNumElements());
 
@@ -6639,9 +6638,6 @@
       }
     }
 
-   if (TREE_CODE(TREE_TYPE(elt_value)) == UNION_TYPE)
-     OneEltIsUnion = true;
-   
     // Decode the field's value.
     Constant *Val = Convert(elt_value);
    
@@ -6682,29 +6678,9 @@
   }
   
   // Fill in null elements with zeros.
-  unsigned InitSize = 0;
   for (unsigned i = 0, e = ResultElts.size(); i != e; ++i) {
     if (ResultElts[i] == 0)
       ResultElts[i] = Constant::getNullValue(STy->getElementType(i));
-    InitSize += getTargetData().getABITypeSize(ResultElts[i]->getType());
-  }
-
-  // If the struct has a fixed size, and if one the union value we converted isn't 
-  // large enough to fill all the bits, add a zero initialized array at the end to pad
-  // it out.
-  tree StructType = TREE_TYPE(exp);
-  if (OneEltIsUnion && 
-      TYPE_SIZE(StructType) && TREE_CODE(TYPE_SIZE(StructType)) == INTEGER_CST) {
-    unsigned StructSize = ((unsigned)TREE_INT_CST_LOW(TYPE_SIZE(TREE_TYPE(exp)))+7)/8;
-    if (StructSize != InitSize) {
-      const Type *FillTy;
-      assert(StructSize > InitSize && "Init shouldn't be larger than struct!");
-      if (StructSize - InitSize == 1)
-        FillTy = Type::Int8Ty;
-      else
-        FillTy = ArrayType::get(Type::Int8Ty, StructSize - InitSize);
-      ResultElts.push_back(Constant::getNullValue(FillTy));
-    }
   }
 
   return ConstantStruct::get(ResultElts, STy->isPacked());





More information about the llvm-commits mailing list