From a7ac2bd4076096bb3a9986dd5a44f20c7f715518 Mon Sep 17 00:00:00 2001 From: Dale Johannesen Date: Mon, 1 Oct 2007 23:08:35 +0000 Subject: [PATCH] Fix stride computations for long double arrays. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42508 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/AsmPrinter.cpp | 6 +++++- lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp | 4 ++-- lib/Transforms/Scalar/LoopStrengthReduce.cpp | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 488185d9bb6..0ad0ec7b1f1 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/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(CV)) { diff --git a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 23ad28f33b1..b6bfd3cea33 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -2279,13 +2279,13 @@ void SelectionDAGLowering::visitGetElementPtr(User &I) { if (ConstantInt *CI = dyn_cast(Idx)) { if (CI->getZExtValue() == 0) continue; uint64_t Offs = - TD->getTypeSize(Ty)*cast(CI)->getSExtValue(); + TD->getABITypeSize(Ty)*cast(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 diff --git a/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/lib/Transforms/Scalar/LoopStrengthReduce.cpp index fea3c420d9e..08f023b712f 100644 --- a/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -286,7 +286,7 @@ SCEVHandle LoopStrengthReduce::GetExpressionSCEV(Instruction *Exp, Loop *L) { Value *OpVal = getCastedVersionOf(opcode, GEP->getOperand(i)); SCEVHandle Idx = SE->getSCEV(OpVal); - uint64_t TypeSize = TD->getTypeSize(GTI.getIndexedType()); + uint64_t TypeSize = TD->getABITypeSize(GTI.getIndexedType()); if (TypeSize != 1) Idx = SCEVMulExpr::get(Idx, SCEVConstant::get(ConstantInt::get(UIntPtrTy,