summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-10-01 23:08:35 +0000
committerDale Johannesen <dalej@apple.com>2007-10-01 23:08:35 +0000
commitb6c05b1f90bb2e46cf120ecdd74289cf601e615b (patch)
treeb2586567c57c86d6aa43b7ec16fce37192eec585 /llvm/lib/CodeGen
parente5e25fae1d9e9582870e927de831e13e29a6ad4f (diff)
downloadbcm5719-llvm-b6c05b1f90bb2e46cf120ecdd74289cf601e615b.tar.gz
bcm5719-llvm-b6c05b1f90bb2e46cf120ecdd74289cf601e615b.zip
Fix stride computations for long double arrays.
llvm-svn: 42508
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/AsmPrinter.cpp6
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp4
2 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter.cpp
index 488185d9bb6..0ad0ec7b1f1 100644
--- a/llvm/lib/CodeGen/AsmPrinter.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter.cpp
@@ -816,8 +816,12 @@ void AsmPrinter::EmitGlobalConstant(const Constant *CV) {
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)) {
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 23ad28f33b1..b6bfd3cea33 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -2279,13 +2279,13 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) {
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
OpenPOWER on IntegriCloud