summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2016-12-02 03:20:58 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2016-12-02 03:20:58 +0000
commitbc0705240e0f57f16919382b3b75263df9a9f2a5 (patch)
tree1ff0e7415c4d6295cb4baa6ea63b4b38469ff123 /llvm/lib/Transforms/Scalar
parentc3be225895ec2373753b2a23f5aced6bad872d81 (diff)
downloadbcm5719-llvm-bc0705240e0f57f16919382b3b75263df9a9f2a5.tar.gz
bcm5719-llvm-bc0705240e0f57f16919382b3b75263df9a9f2a5.zip
IR: Move NumElements field from {Array,Vector}Type to SequentialType.
Now that PointerType is no longer a SequentialType, all SequentialTypes have an associated number of elements, so we can move that information to the base class, allowing for a number of simplifications. Differential Revision: https://reviews.llvm.org/D27122 llvm-svn: 288464
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
-rw-r--r--llvm/lib/Transforms/Scalar/SROA.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index 258e77e9260..1f9d08528ef 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -3222,13 +3222,8 @@ static Type *getTypePartition(const DataLayout &DL, Type *Ty, uint64_t Offset,
Type *ElementTy = SeqTy->getElementType();
uint64_t ElementSize = DL.getTypeAllocSize(ElementTy);
uint64_t NumSkippedElements = Offset / ElementSize;
- if (ArrayType *ArrTy = dyn_cast<ArrayType>(SeqTy)) {
- if (NumSkippedElements >= ArrTy->getNumElements())
- return nullptr;
- } else if (VectorType *VecTy = dyn_cast<VectorType>(SeqTy)) {
- if (NumSkippedElements >= VecTy->getNumElements())
- return nullptr;
- }
+ if (NumSkippedElements >= SeqTy->getNumElements())
+ return nullptr;
Offset -= NumSkippedElements * ElementSize;
// First check if we need to recurse.
OpenPOWER on IntegriCloud