summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/Constants.cpp
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/IR/Constants.cpp
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/IR/Constants.cpp')
-rw-r--r--llvm/lib/IR/Constants.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp
index b6af6ed111a..6a6820234a0 100644
--- a/llvm/lib/IR/Constants.cpp
+++ b/llvm/lib/IR/Constants.cpp
@@ -794,10 +794,8 @@ UndefValue *UndefValue::getElementValue(unsigned Idx) const {
unsigned UndefValue::getNumElements() const {
Type *Ty = getType();
- if (auto *AT = dyn_cast<ArrayType>(Ty))
- return AT->getNumElements();
- if (auto *VT = dyn_cast<VectorType>(Ty))
- return VT->getNumElements();
+ if (auto *ST = dyn_cast<SequentialType>(Ty))
+ return ST->getNumElements();
return Ty->getStructNumElements();
}
OpenPOWER on IntegriCloud