The attached patch, plus the bits I've checked in, seems to work.
There are no problems in the llvm testsuite but there's something
funny going on in the gcc testsuite, although I'm not convinced it's
the fault of this patch, so I'm not checking it in until I get that
figured out. You could see if it works for you.
Index: lib/CodeGen/AsmPrinter.cpp
===================================================================
--- lib/CodeGen/AsmPrinter.cpp (revision 42486)
+++ lib/CodeGen/AsmPrinter.cpp (working copy)
@@ -816,8 +816,12 @@
if (CVA->isString()) {
EmitString(CVA);
} else { // Not a string. Print the values in successive locations
- for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i)
+ for (unsigned i = 0, e = CVA->getNumOperands(); i != e; ++i) {
EmitGlobalConstant(CVA->getOperand(i));
+ const Type* EltTy = CVA->getType()->getElementType();
+ uint64_t padSize = TD->getABITypeSize(EltTy) - TD->getTypeSize(EltTy);
+ EmitZeros(padSize);
+ }
}
return;
} else if (const ConstantStruct *CVS = dyn_cast<ConstantStruct>(CV)) {
Index: lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (revision 42486)
+++ lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp (working copy)
@@ -2279,13 +2279,13 @@
if (ConstantInt *CI = dyn_cast<ConstantInt>(Idx)) {
if (CI->getZExtValue() == 0) continue;
uint64_t Offs =
- TD->getTypeSize(Ty)*cast<ConstantInt>(CI)->getSExtValue();
+ TD->getABITypeSize(Ty)*cast<ConstantInt>(CI)->getSExtValue();
N = DAG.getNode(ISD::ADD, N.getValueType(), N,
getIntPtrConstant(Offs));
continue;
}
// N = N + Idx * ElementSize;
- uint64_t ElementSize = TD->getTypeSize(Ty);
+ uint64_t ElementSize = TD->getABITypeSize(Ty);
SDOperand IdxN = getValue(Idx);
// If the index is smaller or larger than intptr_t, truncate or extend
_______________________________________________
llvm-commits mailing list
llvm-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits