Remove code which assumes it knows how vectors are stored in memory.

llvm-svn: 97141
This commit is contained in:
Dan Gohman 2010-02-25 16:05:33 +00:00
parent e790b61ebd
commit 935faff0bd
1 changed files with 2 additions and 12 deletions

View File

@ -334,11 +334,7 @@ static Constant *getFoldedSizeOf(const Type *Ty, const Type *DestTy,
Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true); Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true);
return ConstantExpr::getNUWMul(E, N); return ConstantExpr::getNUWMul(E, N);
} }
if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {
Constant *N = ConstantInt::get(DestTy, VTy->getNumElements());
Constant *E = getFoldedSizeOf(VTy->getElementType(), DestTy, true);
return ConstantExpr::getNUWMul(E, N);
}
if (const StructType *STy = dyn_cast<StructType>(Ty)) if (const StructType *STy = dyn_cast<StructType>(Ty))
if (!STy->isPacked()) { if (!STy->isPacked()) {
unsigned NumElems = STy->getNumElements(); unsigned NumElems = STy->getNumElements();
@ -464,13 +460,7 @@ static Constant *getFoldedOffsetOf(const Type *Ty, Constant *FieldNo,
Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true); Constant *E = getFoldedSizeOf(ATy->getElementType(), DestTy, true);
return ConstantExpr::getNUWMul(E, N); return ConstantExpr::getNUWMul(E, N);
} }
if (const VectorType *VTy = dyn_cast<VectorType>(Ty)) {
Constant *N = ConstantExpr::getCast(CastInst::getCastOpcode(FieldNo, false,
DestTy, false),
FieldNo, DestTy);
Constant *E = getFoldedSizeOf(VTy->getElementType(), DestTy, true);
return ConstantExpr::getNUWMul(E, N);
}
if (const StructType *STy = dyn_cast<StructType>(Ty)) if (const StructType *STy = dyn_cast<StructType>(Ty))
if (!STy->isPacked()) { if (!STy->isPacked()) {
unsigned NumElems = STy->getNumElements(); unsigned NumElems = STy->getNumElements();