diff options
author | Nadav Rotem <nrotem@apple.com> | 2012-12-18 05:23:31 +0000 |
---|---|---|
committer | Nadav Rotem <nrotem@apple.com> | 2012-12-18 05:23:31 +0000 |
commit | e21708e4aaf741d0c9ccb5a5ddc75738fea7b61f (patch) | |
tree | 4a1baf833079271d049f9bcdfd79a6fab09db5cd /lib/Transforms/Scalar/SROA.cpp | |
parent | f8cd4df30488f182975075be095f3cdd1f9f5a30 (diff) | |
download | external_llvm-e21708e4aaf741d0c9ccb5a5ddc75738fea7b61f.zip external_llvm-e21708e4aaf741d0c9ccb5a5ddc75738fea7b61f.tar.gz external_llvm-e21708e4aaf741d0c9ccb5a5ddc75738fea7b61f.tar.bz2 |
SROA: Replace calls to getScalarSizeInBits to DataLayout's API because
getScalarSizeInBits could not handle vectors of pointers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170412 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar/SROA.cpp')
-rw-r--r-- | lib/Transforms/Scalar/SROA.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Transforms/Scalar/SROA.cpp b/lib/Transforms/Scalar/SROA.cpp index a0ee849..11dd049 100644 --- a/lib/Transforms/Scalar/SROA.cpp +++ b/lib/Transforms/Scalar/SROA.cpp @@ -1669,9 +1669,9 @@ static bool accumulateGEPOffsets(const DataLayout &TD, GEPOperator &GEP, APInt TypeSize(Offset.getBitWidth(), TD.getTypeAllocSize(GTI.getIndexedType())); if (VectorType *VTy = dyn_cast<VectorType>(*GTI)) { - assert((VTy->getScalarSizeInBits() % 8) == 0 && + assert((TD.getTypeSizeInBits(VTy->getScalarType()) % 8) == 0 && "vector element size is not a multiple of 8, cannot GEP over it"); - TypeSize = VTy->getScalarSizeInBits() / 8; + TypeSize = TD.getTypeSizeInBits(VTy->getScalarType()) / 8; } GEPOffset += OpC->getValue().sextOrTrunc(Offset.getBitWidth()) * TypeSize; @@ -1762,7 +1762,7 @@ static Value *getNaturalGEPRecursively(IRBuilder<> &IRB, const DataLayout &TD, // extremely poorly defined currently. The long-term goal is to remove GEPing // over a vector from the IR completely. if (VectorType *VecTy = dyn_cast<VectorType>(Ty)) { - unsigned ElementSizeInBits = VecTy->getScalarSizeInBits(); + unsigned ElementSizeInBits = TD.getTypeSizeInBits(VecTy->getScalarType()); if (ElementSizeInBits % 8) return 0; // GEPs over non-multiple of 8 size vector elements are invalid. APInt ElementSize(Offset.getBitWidth(), ElementSizeInBits / 8); @@ -2010,7 +2010,7 @@ static bool isVectorPromotionViable(const DataLayout &TD, return false; uint64_t VecSize = TD.getTypeSizeInBits(Ty); - uint64_t ElementSize = Ty->getScalarSizeInBits(); + uint64_t ElementSize = TD.getTypeSizeInBits(Ty->getScalarType()); // While the definition of LLVM vectors is bitpacked, we don't support sizes // that aren't byte sized. @@ -2370,9 +2370,9 @@ public: ++NumVectorized; VecTy = cast<VectorType>(NewAI.getAllocatedType()); ElementTy = VecTy->getElementType(); - assert((VecTy->getScalarSizeInBits() % 8) == 0 && + assert((TD.getTypeSizeInBits(VecTy->getScalarType()) % 8) == 0 && "Only multiple-of-8 sized vector elements are viable"); - ElementSize = VecTy->getScalarSizeInBits() / 8; + ElementSize = TD.getTypeSizeInBits(VecTy->getScalarType()) / 8; } else if (isIntegerWideningViable(TD, NewAI.getAllocatedType(), NewAllocaBeginOffset, P, I, E)) { IntTy = Type::getIntNTy(NewAI.getContext(), |